Files
KanbanGit/app/Actions/Notifications/QueueTicketStatusChangedNotificationDeliveries.php
T

24 lines
688 B
PHP

<?php
namespace App\Actions\Notifications;
use App\Models\NotificationAction;
class QueueTicketStatusChangedNotificationDeliveries
{
public function handle(TicketStatusChanged $event): void
{
NotificationAction::query()
->enabled()
->where('project_id', $event->payload->projectId)
->where('event_type', $event->payload->eventType->value)
->get(['id'])
->each(function (NotificationAction $notificationAction) use ($event): void {
DeliverNotificationAction::dispatch(
$notificationAction->id,
$event->payload,
);
});
}
}