Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public function index(Request $req)
  2. {
  3. if ($req->has('search') && !empty($req->search)) {
  4.  
  5. $validated = $req->validate([
  6. 'search' => 'alpha',
  7. ]);
  8.  
  9. $auteurs = Auteur::where('nom', 'LIKE', '%' . $validated['search'] . '%')->paginate(5);
  10. $auteurs->appends($req->only('search'));
  11. return view('admin.auteurs.index', compact('auteurs'));
  12. }
  13.  
  14. $auteurs = Auteur::paginate(5);
  15. return view('admin.auteurs.index', compact('auteurs'));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement