Laravel发现意外数据

时间:2019-01-25 19:53:39

标签: laravel laravel-5 php-carbon

我正在尝试通过Laravel和Carbon来计算以分钟为单位的时差。

我的查询:$findPauseWorky = ClockingSystemHours::where('total_time','=', null)->where('worky_id','=',$id)->whereNotNull('end_time')->get();

从查询中获取集合时,结果如下:

Collection {#407
  #items: array:1 [
    0 => ClockingSystemHours {#408
      #dates: array:3 [
        0 => "start_time"
        1 => "end_time"
        2 => "total_time"
      ]
      #original: array:8 [
        "id" => 2
        "start_time" => "16:21:29"
        "end_time" => "23:20:52"
        "total_time" => null
        "worky_id" => 2
        "employee_id" => 1
        "created_at" => "2019-01-24 16:21:29"
        "updated_at" => "2019-01-24 16:21:29"
      ]

您会在结果中看到,我已经在模型中设置了$dates

如果我执行此dd($findPauseWorky->first()->start_time);,则会导致以下结果:

Unexpected data found.
    ↵Unexpected data found.
    ↵Data missing

当我执行以下操作时:dd($findPauseWorky->first()->worky_id);会导致以下结果: 2

我在做什么错?还是我无法访问数据的原因?

0 个答案:

没有答案