Laravel Validation date format Example

Admin   Laravel   213  2021-03-14 23:10:05

Hi Guys,

Today, I will learn you to create validation date in laravel.we will show example of laravel validation date.The field under validation must be a value a given date. The dates will be passed into the strtotime PHP function.you can simply apply to validation to date validation in laravel.

Here, I will give you full example for simply date validation in laravel bellow.

solution

 

$request->validate([

'date' => 'required|date|date_format:Y-m-d',

]);

Route : routes/web.php

 

Route::get('form/create','[email protected]');

Route::post('form/store','[email protected]')->name('form.store');

Controller : app/Http/Controllers/BlogController.php