Hi guys i'm trying to Load all Collection with Items inside Collection with Eager Load but i only want 5 items , how do i do that?
Currently i'm doing $collectionList = Collection::where('user_id','=',$user_details->id)->get();
To get a list of Collection. I'm looking if i can use Limit or Select only a fix amount of items while displaying the Main Collection. The aim is to display the Collection with some example of the items inside this collection. Therefore it wont make sense if i load all 500 items and only use 6.
Thanks in advance! Any advice is appreciated
I think you are talking about pagination.
like,
$collectionList = Collection::where('user_id','=',$user_details->id)->paginate(5);
See more at http://laravel.com/docs/pagination
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community