If you don't use validate() or Form Request, but still need to throw errors with the same 422 status code and error structure, you can do it manually throw ValidationException::withMessages()
if (! $user || ! Hash::check($request->password, $user->password)) { throw ValidationException::withMessages([ 'email' => ['The provided credentials are incorrect.'], ]);}
Enjoyed This Tip?
Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.
Recent Courses
Livewire v3 to v4: Changes You Need to Know
7 lessons
31 min
PhpStorm Junie AI for Laravel Projects: Crash Course
7 lessons
36 min
Claude Code for Laravel Projects: Crash Course
8 lessons
48 min