Laravel 5 类Carbon\Carbon的对象无法转换为int-LARAVEL

Laravel 5 类Carbon\Carbon的对象无法转换为int-LARAVEL,laravel-5,php-carbon,Laravel 5,Php Carbon,如果计划已过期,我如何执行?在中,我希望返回“比赛将很快开始”的状态 代码如下: @if($match->schedule > 0) &nbsp;<strong id="match_schedule">Match will start soon</strong> @endif @if($match->schedule>0) 比赛即将开始 @恩迪夫 我试过: @if($match->schedule > $match-&g

如果计划已过期,我如何执行?在中,我希望返回“比赛将很快开始”的状态

代码如下:

 @if($match->schedule > 0)
      &nbsp;<strong id="match_schedule">Match will start soon</strong>
 @endif
@if($match->schedule>0)
比赛即将开始
@恩迪夫
我试过:

@if($match->schedule > $match->schedule)
      &nbsp;<strong id="match_schedule">Match will start soon</strong>
@endif
@if($match->schedule>$match->schedule)
比赛即将开始
@恩迪夫

但它不起作用。有什么想法吗?

似乎您正在尝试将碳实例与int
0
进行比较。这会导致异常:

类Carbon\Carbon的对象无法转换为int

您可以通过如下方式进行比较来检查计划是否在过去:

@if($match->schedule < Carbon\Carbon::now())
    &nbsp;<strong id="match_schedule">Match will start soon</strong>
@endif
@if($match->schedule
似乎您正在尝试将碳实例与int
0
进行比较。这会导致异常:

类Carbon\Carbon的对象无法转换为int

您可以通过如下方式进行比较来检查计划是否在过去:

@if($match->schedule < Carbon\Carbon::now())
    &nbsp;<strong id="match_schedule">Match will start soon</strong>
@endif
@if($match->schedule