0
我想在我的日期使用一個訪問器變異函數,但得到各種各樣的錯誤。Laravel 5日期變異函數
目前:
public function getCreatedAtAttribute($date)
{
return $date->diffForHumans();
}
,但我得到:
Call to a member function diffForHumans() on string
我只是想使用在日創建的碳功能,但總是得到這個錯誤。
任何幫助?
你不想使用PHP的日期函數? – aldrin27
將created_at添加到模型的$ dates數組中 – zeratulmdq