Reputation: 54
How do I implement if the schedule has been expired where in I want to return a status of "Match will start soon".
here is the code:
@if($match->schedule > 0)
<strong id="match_schedule">Match will start soon</strong>
@endif
I tried :
@if($match->schedule > $match->schedule)
<strong id="match_schedule">Match will start soon</strong>
@endif
but it doesn't work. any ideas?
Upvotes: 0
Views: 181
Reputation: 8739
It seems you are trying to compare a Carbon instance to int 0
. This causes the exception:
Object of class Carbon\Carbon could not be converted to int.
You can check if the schedule lies in the past by comparing it like this:
@if($match->schedule < Carbon\Carbon::now())
<strong id="match_schedule">Match will start soon</strong>
@endif
Upvotes: 2