Is it possible to use paginate() with the select() method? Using the code below I get the error:
Call to a member function paginate() on a non-object
$query = 'SELECT * FROM items';
$results = DB::select($query)->paginate(10);
I know the following code works with paginate() with just the table() method:
$results = DB::table('plans_shared')->paginate(10);
It seems much easier for me to use the select() since I have many conditional AND/WHERE clauses
select() method returns array so paginate() cannot be called on it. You can only try to use \Paginator::make(DB::select($query))
if you like
If you have an array and want to paginate it use Paginate::make()
Paginate Laravel 4.2
Ex:
$pages = Paginate::make(DB::select($query), 10);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With