mardi 25 juin 2019

Database Notifications not working but email notifications are working in laravel

I wanted to make a notification system in laravel when someone comment on a post the owner that post recieves a notification regarding the comment

Contoller

 public function store(Request $request)
    {
        $comment = new Comment;
        $comment->user_id = Auth::id();
        $comment->post_id = $request->post_id;
        $comment->body = $request->body;
        $comment->save();
        $c = Comment::where('id',$comment->id)->with('user')->first();
        broadcast(new NewComment($c));//->toOthers();
        $post = Post::find($request->post_id);
        $user = User::find($post->user->id);
        Notification::send($user, new CommentToPost($c));
        return $c->toJson();

    }



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/31SiFmx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire