In my blog application there users can post articles and comments on there. When I go to any user profile http://eloquent-laravel.app/user/Name then I want to eagerly loaded all articles and comments of that certain user. Here's my code but it's not eagerly loading all articles and comments.
How can I eagerly loaded these articles and comments? Thanks
$user = \App\User::with(['articles', 'comments'])->where('name', $name)->first(); return view('articles.user', compact('user'))->render();
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community