I want to validate two date fields in a form which is from_date and end_date. Need to check from_date is less than end_date.
$rules = array(\'from_date\' => a
Anyhow,
I did as like this. So that even if any date in the form is empty that will auto fill and check the validation
$inputs = Input::all();
if(!empty($inputs))
{
$default_date_arr = array('from_date' => date('Y-m-d', strtotime('-1 days')), 'to_date' => date('Y-m-d'));
$inputs = $inputs+$default_date_arr;
}
$rules = array('from_date' => array('sometimes','date_format:"Y-m-d"', 'before:'.$to_date) ,
'to_date' => array('sometimes','date_format:"Y-m-d"', 'after:'.$from_date ) );
$validator = Validator::make($inputs,$rules);
if($validator->fails())
{ ... }
This may not be the answer for what i asked. But i needed just a way to finish this. May be will helpful for others.