> */ public function rules(): array { return [ 'name' => ['required', 'string', 'max:120'], 'description' => ['nullable', 'string', 'max:500'], 'body' => ['required', 'string'], 'tags' => ['nullable', 'array'], // Global middleware (TrimStrings + ConvertEmptyStringsToNull) rewrites // empty/whitespace-only entries to null before validation, so null is // accepted and stripped during normalization (PromptService::tagIds); // other non-strings are rejected. 'tags.*' => [ fn ($attribute, $value, $fail) => $value !== null && ! is_string($value) ? $fail('Each tag must be a string.') : true, 'max:40', ], ]; } }