[ 'required', 'string', 'min:3', function (string $attribute, mixed $value, \Closure $fail): void { $wordCount = str_word_count(strip_tags(trim($value))); if ($wordCount > 400) { $fail("The {$attribute} must not exceed 400 words (you provided {$wordCount} words)."); } }, ], ]; } public function authorize(): bool { return true; } }