Files
ladill-frontdesk/app/Services/Frontdesk/NotificationPreferenceService.php
T
isaaccladandCursor 9e2d79936c
Deploy Ladill Frontdesk / deploy (push) Failing after 35s
Test / test (push) Failing after 2m45s
Initial Ladill Frontdesk release with deploy pipeline.
Visitor management app with SSO, kiosk, badges, reports, and Gitea CI deploy to frontdesk.ladill.com.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-27 20:37:15 +00:00

30 lines
869 B
PHP

<?php
namespace App\Services\Frontdesk;
use App\Models\Organization;
class NotificationPreferenceService
{
/** @return list<string> */
public function channelsForEvent(Organization $organization, string $event): array
{
if (! $this->isEventEnabled($organization, $event)) {
return [];
}
return array_values(array_filter(
$organization->settings['notification_channels'] ?? ['email'],
fn (string $channel) => in_array($channel, array_keys(config('frontdesk.notification_channels', [])), true),
));
}
public function isEventEnabled(Organization $organization, string $event): bool
{
$events = $organization->settings['notification_events']
?? config('frontdesk.default_notification_events', []);
return (bool) ($events[$event] ?? true);
}
}