可以從控制器或命令訪問getDateFormat()方法嗎?從控制器訪問getDateFormat() - Laravel
我可以用它在我的模型是這樣的:在我的控制器或命令使用它的時候,像這樣$format = getDateFormat();
public function getCreatedAtAttribute($value)
{
$format = $this->getDateFormat();
return Carbon::createFromFormat($format, $value, 'UTC')->setTimezone(\Helper::getTimezone());
}
但是,我得到以下錯誤:
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined function App\Console\Commands\getDateFormat()'
超級,謝謝@Silwerclaw – user3489502