@php use App\Support\NotificationTuneLibrary; $notificationNotifiable = auth('admin')->user() ?? auth()->user(); $notificationTunePayload = function (array $tune): array { if (isset($tune['file'])) { $tune['file_url'] = asset($tune['file']); } return $tune; }; $notificationTuneConfig = [ 'notificationsEnabled' => $notificationNotifiable ? $notificationNotifiable->notificationDeliveryEnabled() : (bool) setting('notification_delivery_enabled', true), 'soundEnabled' => $notificationNotifiable ? $notificationNotifiable->notificationSoundEnabled() : (bool) setting('notification_tune_sound_enabled', true), 'defaultTuneKey' => NotificationTuneLibrary::defaultKey(), 'tune' => $notificationNotifiable ? $notificationTunePayload($notificationNotifiable->notificationTunePayload()) : $notificationTunePayload(NotificationTuneLibrary::resolve(NotificationTuneLibrary::defaultKey())), 'tunes' => collect(NotificationTuneLibrary::tunes()) ->map(fn (array $tune): array => $notificationTunePayload($tune)) ->all(), ]; @endphp