status = $status; $this->mention = $mention; } /** * Execute the job. * * @return void */ public function handle() { $status = $this->status; $mention = $this->mention; $actor = $this->status->profile; $target = $this->mention->profile_id; $exists = Notification::whereProfileId($target) ->whereActorId($actor->id) ->whereIn('action', ['mention', 'comment']) ->whereItemId($status->id) ->whereItemType('App\Status') ->count(); if ($actor->id === $target || $exists !== 0) { return true; } Notification::firstOrCreate( [ 'profile_id' => $target, 'actor_id' => $actor->id, 'action' => 'mention', 'item_type' => 'App\Status', 'item_id' => $status->id, ] ); StatusService::del($status->id); } }