Back

Ever assumed Laravel's after() method runs after validation passes?

Plot twist: it runs after validation completes - even when it fails πŸ˜…

Found this out when DB queries were hitting on invalid requests. Worse - got 500 errors when callbacks tried processing bad data.

Quick fix? Check if validator has errors first and bail early.

But real talk - DB queries don't belong in Form Requests. Keep validation fast, move heavy stuff to services.
dev.to/tegos/laravel-validation-after-after-what-exactly-28fa

β€’ β€’

38

β€’
β€’
  • No matching results...
  • Searching...

/ 1000

Poll Options