Agelios's avatar

Pagination

Hello. Im interesting about one question. For example i have model Products with relation (ex. languages). And i need to paginate it. If i use Products::paginate(10) i will on view use code like {{ $product->language()->find(id)->pivot->value}}. But its ugly. Does laravel have instruments for it?

0 likes
3 replies
J_shelfwood's avatar

Yeah exactly, If you're still using find() in your view that might mean you have to do something extra in your controller, like only load the languages you need

Agelios's avatar

@Hawkleaf if i want to find something in my relation, i must have a collection of my model. $products=Products::all(); foreach $products and so on. But after that i cant use paginate on this.

Please or to participate in this conversation.