app/Http/Requests/LeaveConfigurationRequest.php
/**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
Get the validation rules that apply to the request.
@return array
Get the validation rules that apply to the request . @return array
public function rules()
    {
        if($this->method()=='PUT'){
            return [
                    'startdate' => 'required',
                    'enddate' => 'required',
                    'leavetype' => 'required',
                    'reason' => 'required',
                    'note' => 'required',
                ];
        }else{
            return [
                    'onedate' => 'required_if:leaveDate,==,0',
                    'startdate' => 'required_if:leaveDate,==,1',
                    'enddate' => 'required_if:leaveDate,==,1',
                    'leavetype' => 'required',
                    'reason' => 'required',
            ];
        }
    }
public function rules ( ) { if ( $ this -> method ( ) == 'PUT' ) { return [ 'startdate' => 'required' , 'enddate' => 'required' , 'leavetype' => 'required' , 'reason' => 'required' , 'note' => 'required' , ] ; } else { return [ 'onedate' => 'required_if:leaveDate,==,0' , 'startdate' => 'required_if:leaveDate,==,1' , 'enddate' => 'required_if:leaveDate,==,1' , 'leavetype' => 'required' , 'reason' => 'required' , ] ; } }
Get the validation rules that apply to the request.
Get the validation rules that apply to the request .