boyanr's avatar

Strange issue with pagination

This works:

$invoices = Invoice::orderBy('id','desc')->paginate(20);

But if I change it to this it gives an error at Builder::links():

$invoices = Invoice::orderBy('id','desc'); $invoices->paginate(20);

Any ideas? I need it separated, because I'm going to add some dynamic where clauses in the middle...

0 likes
1 reply
boyanr's avatar
boyanr
OP
Best Answer
Level 1

OK I fixed it by using: $results = $invoices->paginate(20);

makes sense now that I think of it, but I was initially mislead by an example I saw somewhere

Please or to participate in this conversation.