Level 52
If you query with paginate you get a LengthAwarePaginator object otherwise you get a Collection, so you can check this type.
1 like
Hi all,
I'm trying to reuse a view across a few different controller methods / routes, and it's working fine except that I want to paginate all but 1 of them.
I have one method that calls a collection, then does some work on it, and then outputs it to the page. I can't figure out how to paginate this correctly, and if I just pass a full collection the "$collection->render()" method on my view breaks down.
So is there a way to check for pagination? Something like this would be awesome:
@if($collection->isPaginated)
@endif
Thanks for any help!
Please or to participate in this conversation.