Level 122
if your top model is a single model, then you don't need eager loading.
Suppose you already have $book
$comments = $book->comments()->paginate(10);
then pass both $book and $comments to the view.
Hello, I want to display a book. Everything is correct. But I want the comments to be in the form of a paginate. Only the comments. What is the solution? My code:
public function show(Book $book) { return $book->load(['categories', 'comments'])->toResource(); }
I want the comments to be in the form of a pitch.
Please or to participate in this conversation.