Recall & Review
beginner
What does the
required validation rule do in Laravel?The
required rule ensures that the field must be present in the input data and not empty. It is used to make a field mandatory.Click to reveal answer
beginner
Explain the
email validation rule in Laravel.The
email rule checks if the input is a valid email address format. It helps ensure the user enters a proper email.Click to reveal answer
intermediate
What is the purpose of the
unique validation rule?The
unique rule checks that the value does not already exist in a specified database table column. It prevents duplicate entries.Click to reveal answer
beginner
How does the
confirmed validation rule work?The
confirmed rule requires that there is a matching field with the same name plus _confirmation. For example, password must match password_confirmation.Click to reveal answer
beginner
What does the
max validation rule do?The
max rule limits the maximum size of the input. For strings, it limits the number of characters; for numbers, it limits the numeric value.Click to reveal answer
Which Laravel validation rule ensures a field is not empty?
✗ Incorrect
The
required rule makes sure the field is present and not empty.What does the
unique validation rule check?✗ Incorrect
The
unique rule checks that the value does not exist already in a database table column.Which rule validates that two fields have matching values?
✗ Incorrect
The
confirmed rule requires a matching _confirmation field with the same value.What does the
max:10 rule do for a string input?✗ Incorrect
For strings,
max:10 limits the input to 10 characters maximum.Which rule allows a field to be empty but validates if present?
✗ Incorrect
The
nullable rule allows the field to be empty but validates it if it has a value.List and explain five common Laravel validation rules and when to use them.
Think about rules that check presence, format, uniqueness, matching, and size.
You got /5 concepts.
How would you validate a password field that must be present, confirmed, and at least 8 characters long?
Combine multiple rules separated by | in Laravel.
You got /3 concepts.