You should use paginate when you retreive the records from the database.
$doctor = Auth::user()->meeting()->paginate(2);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How can I turn my $monday Collection into a query to paginate it?
$doctor = Auth::user()->meeting()->get();
$monday = optional($doctor->map->meeting->flatten()->where('start', '=', '12:00:00'))->paginate(2);
$monday = optional($doctor->map->meeting->flatten()->where('start', '=', '12:00:00'))->take(2); // works
Currently I get a paginate does not exist, as we can only invoke paginate on a Query, not on a Collection.
Method Illuminate\Support\Collection::paginate does not exist
@FTIERSCH - Thank you. Yes it contains a collection logic.
I found a solution following this implementation, to paginate the collection. It works great:
https://gist.github.com/simonhamp/549e8821946e2c40a617c85d2cf5af5e
Please or to participate in this conversation.