Created
May 15, 2017 19:59
-
-
Save omarkdev/93ce7023801a2b0e43cdf366cf7a3659 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function store(Request $request) | |
{ | |
// Create a new comment | |
$comment = Comment::create($request->all()); | |
// Find the author and highlight the comment on your profile | |
$user = User::find( $request->get('user_id') ); | |
$user->profile->highlightNewComment($comment); | |
// Author of the post and the users who have already commented | |
$users = $comment->post->users; | |
foreach ($user as $user) { | |
// Notify the user who has a new comment. | |
Notification::hasNewComment($user, $comment); | |
} | |
return ['success' => true]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment