Aman Baweja Aman Baweja - 1 month ago 16
MySQL Question

Pagination in laravel

I am trying to create pagination in laravel but its not working.

Here's the code :

$result=DB::table('sample')
->select()
->where('id','=',1)->orWhere('id','=',2)
->get()->paginate(10);
return $result;

Answer

Try this :

$result=DB::table('sample')
            ->select()
            ->where('id','=',1)->orWhere('id','=',2)
            ->paginate(10);
        return $result;

Paginate will not work with get

Comments