payload(); $eventType = $event->eventType(); NotificationAction::query() ->enabled() ->where('project_id', $payload->projectId()) ->where('event_type', $eventType->value) ->get(['channel', 'filters', 'id']) ->each(function (NotificationAction $notificationAction) use ($event, $payload): void { if (! $this->matchNotificationFilters->handle($notificationAction->filters ?? [], $payload)) { return; } $notificationDeliveryLogId = null; if (in_array($notificationAction->channel, [NotificationChannel::Discord, NotificationChannel::Webhook], true)) { $notificationDeliveryLogId = NotificationDeliveryLog::query()->create([ 'attempt_count' => 0, 'channel' => $notificationAction->channel, 'delivery_status' => NotificationDeliveryStatus::Pending, 'event_type' => $event->eventType(), 'notification_action_id' => $notificationAction->id, 'payload_metadata' => $payload->deliveryMetadata(), ])->id; } DeliverNotificationAction::dispatch( notificationActionId: $notificationAction->id, event: $event, notificationDeliveryLogId: $notificationDeliveryLogId, ); }); } }