public function index(Request $request) { $people = null; $input = $request->all(); if (isset($input[trans_prefix('query_string', 'name')])) { $people = $this->personProvider->getPeopleByName($input[trans_prefix('query_string', 'name')]); } else { $people = $this->personProvider->getPeople(); } return view('admin.spirit.people.index', ['people' => $people->orderBy('updated_at', 'desc')->paginate(25), 'input' => $input]); }
/** * @param $input * @param boolean $withTrashed * * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator|null */ public function findUsers($input, $withTrashed = true) { $result = null; $perPage = 20; if ($input) { switch ($input) { case isset($input[trans_prefix('query_string', 'email')]): $result = $this->findAllByEmailWithPersonInfo($input[trans_prefix('query_string', 'email')]); break; case isset($input[trans_prefix('query_string', 'name')]): $result = $this->findAllByUsernameWithPersonInfo($input[trans_prefix('query_string', 'name')]); break; case isset($input[trans_prefix('query_string', 'recent')]): $result = $this->findAllRecentlySubscribed()->orderBy('users.created_at', 'desc'); break; } if ($withTrashed) { $result = $result->withTrashed(); } } return $result; }