<?php
 namespace App\Traits; use App\Models\Client; trait ChecksNotificationPreference { protected function shouldSendNotification(?Client $client, string $eventType): bool { if (!$client || !$client->group_id) { return true; } $group = $client->clientGroup ?? $client->group; if (!$group) { return true; } $preference = $group->getNotificationPreference($eventType); if ($preference === null) { return true; } return (bool) $preference; } } 