/** * API to store a new reply */ public function apiStoreReply(ReplyRequest $request, Post $post) { logThis(auth()->user()->name . ' replied to ' . $post->title); $request->merge(['user_id' => auth()->user()->id]); $reply = $post->replies()->create($request->all()); return $reply; }
/** * Show a Post */ public function show(Post $post) { $replies = $post->replies()->orderBy('created_at')->get(); return view('posts.show')->with('post', $post)->with('replies', $replies); }