Is it possible to access the getDateFormat() method from a controller or command?
I can use it my models like this:
public function getCreatedAtAttribute($value)
{
$format = $this->getDateFormat();
return Carbon::createFromFormat($format, $value, 'UTC')->setTimezone(\Helper::getTimezone());
}
but when using it in my controller or command, like this $format = getDateFormat();
, I get the following error:
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined function App\Console\Commands\getDateFormat()'
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire