/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // Show all the comments of all of the posts that belong to the subbreddit with the id of $id // Eloquent sees 'posts.comments' as the relationships of posts() and comments() within Subbreddits and Posts, respectively return App\Subbreddit::with('posts.comments.childComments')->find($id); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { return \App\Subbreddit::with(['posts.comments.childComments', 'user'])->find($id); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { return Subbreddit::with(['user', 'posts.comments.childComments'])->findOrFail($id); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { //return \App\Subbreddit::find($id); return \App\Subbreddit::with('posts.comments')->find($id); }