#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Validating Input Data

Accepting user input is only safe once it has been checked against clear rules. Laravel's validation system makes this straightforward, offering a large set of built-in rules along with automatic error handling for the browser-facing side of an application.

Validating Inside a Controller

The most common approach is calling the request's validate() method directly inside a controller, passing an array of field names mapped to validation rules. If validation fails, Laravel automatically redirects back to the previous page with the errors and old input flashed to the session.

Common Validation Rules

RuleWhat It Checks
requiredThe field must be present and not empty
emailThe value must be a properly formatted email address
min:8 / max:255Enforces a minimum or maximum length
unique:users,emailThe value must not already exist in a given table/column
confirmedRequires a matching *_confirmation field, common for passwords

Displaying Errors in a View

Built-in rules cover most situations, but applications often need checks that are specific to their own business logic — which is where custom validation rules and messages come in.

Ready to master Laravel Training Course?

Join Uncodemy's hands-on Laravel program and build real, production-ready applications.

Explore Course