action->object_type); $object = $actionObjectType->modelBuilder()->find($event->action->object_id); if (! $object) { return; } $notification = match ($actionObjectType) { ActionObjectType::PROJECT, ActionObjectType::CONTAINER => new NormalNotification($event->action, $object), ActionObjectType::REQUIREMENT => new RequirementNotification($event->action, $object), ActionObjectType::TASK => new TaskNotification($event->action, $object), default => null, }; $notification?->handle(); } public function shouldQueue(ObjectActionCreate $event): bool { $actionObjectType = ActionObjectType::tryFrom($event->action->object_type); $objectAction = ObjectAction::tryFrom($event->action->action); if (! $actionObjectType || !$objectAction) { return false; } return in_array($objectAction->value, $event->notificationSetting[$actionObjectType->value]['browser'] ?? []); } }