samedi 1 octobre 2016

Access to getDateFormat() from controller - Laravel

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()'



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2cIQxHT
via IFTTT

Aucun commentaire:

Enregistrer un commentaire