比较和获取 Laravel Eloquent 结果的日期

Comparing and getting date from Laravel Eloquent Result

这是我的 ReservationController 中的函数:

public function realtime() {
    // Change to On Going
    $ongoing = Reservation::select('*') 
                            -> where('eventStatus', 'NYD') -> get();
    //dd($ongoing);
    foreach ($ongoing as $og) {
        echo "Started For Each\n";
        //dd($og);

        if ($og -> reservationStart > Carbon::now() && 
            $og -> reservationEnd < Carbon::now()) {
            $og -> eventStatus = "On Going";
            $og -> save();
            echo "Updated to ongoing!";
        }
        else {
            // echo $og -> reservationSTart;
        }

    }

    // Change to Done
}

此函数由任务计划程序触发。任务调度器运行命令php.exe {path/to/my}/artisan schedule:run,当然,php.exe被添加到系统变量PATH中。该任务每分钟触发一次命令。在我的内核中,我在我的调度函数中添加了这段代码:

if (strtolower(env('SYS_REALTIME')) == "yes") {
        $schedule->call('App\Http\Controllers\ReservationController@realtime') -> everyMinute();
}

现在,每次我触发命令(无论是通过手动调度 运行 还是通过任务调度程序触发),我总是会收到错误消息:

Running scheduled command: 
App\Http\Controllers\ReservationController@realtime
Started For Each


[InvalidArgumentException]
Unexpected data found.
Unexpected data found.
Data missing

我希望系统从查询结果中获取时间,然后将其与当前时间进行比较。如果它介于开始时间和结束时间之间,我想将 eventStatus 值切换为 On Going。以下是数据库中的字段列表:

primeID - INT AI
reservationName - VARCHAR(30)
dateReserved - date
reservationStart - time
reservationEnd - time

到目前为止,这是我尝试过的方法:

我的代码有什么问题?

我已经找到答案了。在MySQL中,存储时间时日期被裁剪。我只是将数据类型更改为 datetime,一切正常。