Carbon - 检查数据库中没有记录的时间
Carbon - Checking when there is no record in the database
所以我正在尝试检查数据库中是否存在会话时间的记录。我正在使用碳。
这是我的代码
{{\Carbon\Carbon::parse($data->counsellor_availabilities ? $data->counsellor_availabilities->event_time : "No Time")}}
目前没有时间,所以抛出一个非对象错误,所以我尝试了三元运算符。我得到的错误是。
DateTime::__construct(): Failed to parse time string (No Time) at position 0 (N): The timezone could not be found in the database
试试这个
{{ $data->counsellor_availabilities ? \Carbon\Carbon::parse($data->counsellor_availabilities->event_time) : 'No time' }}
所以我正在尝试检查数据库中是否存在会话时间的记录。我正在使用碳。
这是我的代码
{{\Carbon\Carbon::parse($data->counsellor_availabilities ? $data->counsellor_availabilities->event_time : "No Time")}}
目前没有时间,所以抛出一个非对象错误,所以我尝试了三元运算符。我得到的错误是。
DateTime::__construct(): Failed to parse time string (No Time) at position 0 (N): The timezone could not be found in the database
试试这个
{{ $data->counsellor_availabilities ? \Carbon\Carbon::parse($data->counsellor_availabilities->event_time) : 'No time' }}