samedi 3 octobre 2020

where clause in laravel for search

I am trying to select rows from table students using laravel query for searching but on searching it's returning all rows from table.

$data = DB::table('students')->select(['name', 'username'])->where('institute', $inst)->where('username', 'LIKE', '%'.$search.'%')->orWhere('name', 'LIKE', '%'.$search.'%')->orWhere('email', 'LIKE', '%'.$search.'%')->orWhere('contact', 'LIKE', '%'.$search.'%')->orderBy('id', 'DESC')->paginate(10);


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire