|string> */ public function rules(): array { return [ 'anagram' => ['required', 'string', 'alpha:ascii', 'min:2', 'max:24'], ]; } public function messages(): array { return [ 'anagram.alpha' => 'Letters only — no digits, spaces or punctuation.', 'anagram.max' => 'That is longer than any word in the dictionary.', ]; } // The dictionary is lowercase and Matcher::check compares raw characters, // so an uppercase anagram would silently return nothing. protected function prepareForValidation(): void { $this->merge([ 'anagram' => strtolower((string) $this->input('anagram', '')), ]); } }