SHARE
TWEET

Untitled

a guest Jun 16th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top