Validating input data in flash

by  |  12-Jan-2020 13:33

WTForms does half the form generation for us already.

To make it even nicer, we can write a macro that renders a field with label and a list of errors if there are any.

Validations are used to ensure that the data is of a certain format, type, length, or value.

Almost every interactive web application needs to validate data.

We’ll also explore how those validation methods interact with your model’s attributes and how Laravel’s built-in error-messaging system can be used effectively in your application’s user interface to provide descriptive feedback.

Thankfully, Laravel has a library, aptly named “Validation” that will do all the hard work for us and make this mundane part of programming as simple and as easy as possible.

Why do you need to validate data in the first place?

This is also how we will be able to test to make sure that our new duck/user has a unique email in the database.

Community Discussion