filled('search')){ $userQ = $userQ->where(function($query) use ($request) { $query->where('email', 'like', '%'.$request->search.'%') ->orWhere('username', 'like', '%'.$request->search.'%'); }); } return $userQ->where('id', '!=', auth()->id()) ->whereNotIn('id', request('_business_info')['info']['users']->keys()) ->select('id', 'name', 'email', 'username')->take($limit)->get(); } public function index(Request $request) { $userQ = QueryBuilder::for(User::class) ->allowedFilters([ AllowedFilter::exact('id'), ]); return $userQ->select('id', 'name', 'email', 'username')->get(); } public function show($user) { return User::select('id', 'name', 'email', 'username')->findOrFail($user); } public function update(Request $request, string $user) { $user = User::findOrFail($user); $user->update($request->all()); return $user; } public function setAvatar(Request $request, string $user) { $user = User::findOrFail($user); if ($request->hasFile('avatar')) { $user->saveAsAvatar($request->file('avatar')); } return $user; } public function unSetAvatar(Request $request, string $user) { $user = User::findOrFail($user); $user->deleteAvatar(); return $user; } }