在laravel中验证两个日期。显示未定义的偏移

时间:2018-09-03 15:57:00

标签: laravel-5

无法验证变量。使用此显示错误未定义的偏移量:2。我只想验证垂直字段,以便必须同时输入两个条目才能获取过滤器数据。

public function TimesheetResult(Request $request){

    $datefrom= $request->input('datefrom');
    $dateto= $request->input('dateto');
    $orderfrom = explode('/',$datefrom);
    $orderto = explode('/', $dateto);
    $fromdate = $orderfrom[2]. "-" .$orderfrom[1]. "-" .$orderfrom[0];
    $todate = $orderto[2]. "-" .$orderto[1]. "-" .$orderto[0];

    $values = UserTimesheet::getDataBetweenDates($fromdate, $todate);
    $validator = Validator::make($values, [
        'fromdate'    => 'required|date',
        'todate'      => 'required|date',
    ]);


    return view('admin.timesheet-result',compact('values'));



    // print_r($value); exit;


}

0 个答案:

没有答案