0
0
Laravelframework~5 mins

Available validation rules in Laravel - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Anullable
Bsometimes
Crequired
Dexists
What does the unique validation rule check?
AField is confirmed
BField is unique in a database table
CField is numeric
DField is a valid email
Which rule validates that two fields have matching values?
Aconfirmed
Bsame
Cdifferent
Drequired
What does the max:10 rule do for a string input?
AMakes field optional
BRequires at least 10 characters
CLimits numeric value to 10
DLimits string length to 10 characters
Which rule allows a field to be empty but validates if present?
Anullable
Brequired
Cunique
Dconfirmed
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.