Example #1
0
 /**
  * Create a new event instance.
  *
  * @return void
  */
 public function __construct($location, User $user)
 {
     $this->user = $user;
     //sukuriam paminejima duomenu bazeje.
     $mention = \maze\Mention::create(['user_id' => $user->id, 'object_type' => class_basename($location), 'object_id' => $location->id]);
     $this->notifiable = $mention;
 }
Example #2
0
 /**
  * Handle the event.
  *
  * @param  ReplyWasDeleted  $event
  * @return void
  */
 public function handle($event)
 {
     $name = class_basename($event->notifiable);
     $type = snake_case($name);
     Notification::where('object_type', $type)->where('object_id', $event->notifiable->id)->delete();
     //jeigu strukturoje veikia paminejimu notificationai
     //istrinam notificationus
     //ir paminejimus
     if (in_array($type, $this->mentionable)) {
         Notification::where('object_type', 'mention')->where('object_id', $event->notifiable->id)->delete();
         Mention::where('object_type', $name)->where('object_id', $event->notifiable->id)->delete();
     }
 }