@php /** @var \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Collection $messages */ $messages = $messages ?? collect(); $users = $users ?? collect(); $responsibleUserIds = array_map('intval', $responsibleUserIds ?? []); $contextKey = $contextKey ?? 'chat'; $title = $title ?? 'Чат'; $submitLabel = $submitLabel ?? 'Отправить'; $canSendNotifications = hasRole('admin,manager'); $notificationValue = old('notification_type', \App\Models\ChatMessage::NOTIFICATION_NONE); $selectedTargetUserIds = collect(old('target_user_ids', [])) ->map(static fn ($id) => (int) $id) ->filter() ->unique() ->values() ->all(); @endphp