Hey @kartik,
- In Programming validations are a handy way to ensure that your data is always in a clean and expected format before it gets into your database.
- Laravel provides several different ways to validate your application incoming data
- .By default Laravel’s base controller class uses a ValidatesRequests trait which provides a convenient method to validate all incoming HTTP requests coming from client.
- You can also validate data in laravel by creating Form Request.
Laravel validation Example
$validatedData = $request->validate([
'name' => 'required|max:255',
'username' => 'required|alpha_num',
'age' => 'required|numeric',
]);
Hope this helps!!