user() !== null; } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { /** @var TemplateWorkbook $templateWorkbook */ $templateWorkbook = app(TemplateWorkbook::class); $departmentKeys = array_map( fn (array $department): string => $department['key'], $templateWorkbook->departments(), ); return [ 'department' => ['required', 'string', Rule::in($departmentKeys)], 'sheet' => ['required', 'string', Rule::in($templateWorkbook->sheetKeys())], 'values' => ['required', 'array'], 'values.*' => ['nullable', 'string', 'max:255'], ]; } }