Introduction
Validations check data before saving it. This stops wrong or incomplete data from entering your app.
When you want to make sure a user's email is present and correctly formatted before saving.
When you need to ensure a product's price is a positive number.
When you want to prevent duplicate usernames in your database.
When you want to require that a post has a title before it is saved.
When you want to make sure dates are valid and logical, like an event's end date after its start date.