notifications() ->where('type', WorkspaceInvitation::class) ->limit(20) ->get(); $notification = $notifications->first(function ( DatabaseNotification $notification, ) use ($invite) { return $notification->data['inviteId'] === $invite->id; }); if ($notification) { $notification->delete(); } } }