Laravel 4: Validate start and end date with before and after validation

后端 未结 5 1606
深忆病人
深忆病人 2021-01-27 07:22

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         


        
5条回答
  •  盖世英雄少女心
    2021-01-27 07:48

    Please use the below code in laravel 5.2 and it works fine for validating start and end date.

    $this->validate($request, [
                'start_date' => 'required|before:end_date',
                'end_date' => 'required',
    
            ]); 
    

提交回复
热议问题