I need to build a notification-system similar to facebook. When somebody up / down votes a picture i want to notify the user.
The hard part here is, when as example 12 People liked a Picture I don't want to show 12 entrys i just want to tell the user "12 People liked your photo" but how can I do this with laravel / eloquent?
I already read about grouping but I don't understand this..
My Table looks like that:
$table->increments('id'); $table->integer("user_id")->unsigned(); $table->integer("object_id")->unsigned(); $table->boolean("red")->default(false); $table->enum("type", ["post_like", "post_dislike", "tag_like", "tag_dislike", "comment_like", "comment_dislike"]); $table->integer("sender_id")->unsigned(); $table->timestamps();
Do you have any sources or tipps for my purpose?