ModelStub::getAgeAttribute PHP Method

getAgeAttribute() public method

public getAgeAttribute ( $value )
    public function getAgeAttribute($value)
    {
        $date = DateTime::createFromFormat('U', $this->attributes['birthday']);
        return $date->diff(new DateTime('now'))->y;
    }