I have just started with Laravel and I am trying to make a search function with proper pagination. The function works for page one but on pag
in my case, i've laravel 5.7 installed.
$perPage = $request->per_page ?? 10;
$data['items'] = User::where('name', 'like', '%'. $request->search . '%')
->paginate($perPage)
->appends(['search' => $request->search, 'per_page' => $request->per_page]);
return view('users.index', $data);
and my view files codes are
for per_page select dropdown and search area