jeudi 3 août 2017

Models column date format

I modified my models date property to can calculate birthdays, but now when the date is loaded in my form(I use Form collective) I get it like 1979-07-17 00:00:00 right output should be 1979-07-17

protected $dates = ['geburtstag'];

   public function age()
    {
        return $this->geburtstag->diffInYears(Carbon::now());
    }

I tried to modify from model like

protected $geburtstagFormat = 'Y-m-d';

but did not help.

What I do wrong in this case



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire