From b593b2ddfde667f6941a32e8163fc1e04dcc5739 Mon Sep 17 00:00:00 2001 From: Julian Prieber Date: Tue, 14 Feb 2023 13:45:01 +0100 Subject: [PATCH] Update AdminController.php --- app/Http/Controllers/AdminController.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 2aa0706..414d8e7 100755 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -67,15 +67,21 @@ public function users(Request $request) return view('panel/users', $data); } - - //Search user by name - public function searchUser(request $request) + public function searchUser(Request $request) { - $name = $request->name; - $data['users'] = User::where('name', $name)->select('id', 'name', 'role', 'block')->get(); + $searchTerm = $request->search; + $data['users'] = User::where('name', 'like', "%{$searchTerm}%") + ->orWhere('email', 'like', "%{$searchTerm}%") + ->orWhere('littlelink_name', 'like', "%{$searchTerm}%") + // ->orWhere('role', 'like', "%{$searchTerm}%") + // ->orWhere('block', 'like', "%{$searchTerm}%") + // ->orWhere('email_verified_at', 'like', "%{$searchTerm}%") + ->select('id', 'email', 'name', 'littlelink_name', 'role', 'block', 'email_verified_at') + ->get(); return view('panel/users', $data); } + //Block user public function blockUser(request $request)