vendredi 26 août 2016

How can I get search with pagination in Laravel

In laravel I got only pagination, but I want pagination with searching.

here is my code for pagination.

$leads = DB::table('leads')->join('states','leads.state','=','states.id')->join('districts','leads.district','=','districts.id')->join('users','leads.userid','=','users.id')->select('leads.*','states.name as sname','districts.name as dname','users.name as uname')->orderBy('leads.id', 'desc')->paginate(10);

I have tried pagination with searching but not working properly...

here is the my code

$leads = DB::table('leads')->join('states','leads.state','=','states.id')->join('districts','leads.district','=','districts.id')->join('users','leads.userid','=','users.id')->select('leads.*','states.name as sname','districts.name as dname','users.name as uname')->where('leads.phoneno', 'like', "%$search%")->paginate(10);

please any one can help me where i have mistaken.

Thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2boeF1C
via IFTTT

Aucun commentaire:

Enregistrer un commentaire