public function getAllPaginate($character, $number) { if ($character == "all") { $users = new SdcUser(); } else { $users = SdcUser::where('display_name', 'LIKE', "{$character}%"); } $users = $users->where('id', '<>', Auth::user()->id)->paginate($number); foreach ($users as $key => $user) { switch ($user->sdc_role_id) { case 1: $user->sdc_role_id = "Administrator"; break; case 2: $user->sdc_role_id = "Sub Administrator"; break; default: break; } } return $users; }