I have created a form request file which validates my start_date
form input.
public function rules()
{
return [
'start_date' => 'required|date|after:2017-06-31',
];
}
I have placed a literal value in the after value, this however doesn't look like its working. Can someone advise the best way to do this?
Edit: This is the dump from my $request->all()
;
{
"_token": "tZa4e39ejrGHtrlpOYrUPfZ8PgSeD8FelY4voKni",
"start_date": "2017-07-01"
}
This is my form request validation:
public function rules()
{
return [
'start_date' => 'required|date_format:Y-m-d|after:2017-06-31',
];
}
I am using Laravel v5.4
The dates will be passed into the PHP strtotime function so change your date format to Y-m-d .
public function rules()
{
return [
'start_date' => 'required|date|date_format:Y-m-d|after:2017-06-31',
];
}