Level 10
public function store(Request $request)
{
$reply = Reply::create($request->all());
$comment = // to the comment you are replying
if ($comment->user_id === auth()->id) {
return back()->with('success', 'Reply Submitted Successfully');
}
if ($reply && $reply->comment && $reply->comment->user ) {
$reply->comment->user->notify(new RepliedToComment($reply));
return back()->with('success', 'Reply Submitted Successfully');
}
return back()->with('error', 'Something wrong while submitting this reply!');
}
1 like