In Laravel, why do we use validation when handling user input?
Think about what happens if bad data is saved to the database.
Validation checks data before saving to keep the database clean and reliable.
Consider a Laravel form request with validation rules. What is the default behavior when validation fails?
Think about user experience when they enter wrong data.
Laravel automatically redirects back to the form with errors and old input so users can fix mistakes.
Given this Laravel validation snippet, what will be the output if the input 'age' is 15?
request()->validate(['age' => 'required|integer|min:18']);
Check the 'min:18' rule and the input value.
The 'min:18' rule requires age to be at least 18, so 15 fails validation.
Which option contains a syntax error in Laravel validation rules?
request()->validate(['email' => 'required|email', 'password' => 'required|min:8']);
Look carefully at the 'min' rule syntax.
The 'min' rule requires a colon before the number, so 'min8' is invalid syntax.
Given this code, why does Laravel accept an invalid email like 'user@domain'?
request()->validate(['email' => 'required|email:rfc']);
Consider what 'rfc' and 'dns' options mean in email validation.
'user@domain' matches RFC format but may fail DNS check if domain has no DNS records.