Пример #1
0
 public static function createCommentEvent($post_id, $user_id, $comment)
 {
     $comment_event = new CommentEvent();
     $comment_event->post_id = $post_id;
     $comment_event->user_id = $user_id;
     $comment_event->text = $comment;
     $result = $comment_event->save();
     return $result;
 }
 public function commentPost(Request $request, $post_id)
 {
     $comment = $request->input("comment");
     $user_id = Auth::user()->user_id;
     $result = CommentEvent::createCommentEvent($post_id, $user_id, $comment);
     if ($result) {
         return response()->json(["result" => "successfully"]);
     }
 }
 protected static function boot()
 {
     parent::boot();
     // TODO: Change the autogenerated stub
     CommentEvent::observe(new NotificationObserver());
 }