user()?->can('access-admin') ?? false; } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'user_ids' => ['nullable', 'array'], 'user_ids.*' => ['integer', Rule::exists('users', 'id')], ]; } /** * @return array */ public function userIds(): array { return collect($this->validated('user_ids', [])) ->map(fn (mixed $userId): int => (int) $userId) ->unique() ->values() ->all(); } }