vendredi 4 janvier 2019

How to use 2 variables inside a mutator

i have 2 columns on my DB Date and Hour it is save like 01/04/2019 and 11:01:00 my question is how can i show it like 04/01/2019 11:01 AM using mutators? i know how to parse date and time with Carbon but do not know how to user mutators to join these 2 variables

public function getFechaModalAttribute($start)
{
    return Carbon::parse($start)->format('d/m/Y');
}
public function getHoraModalAttribute($time)
{
    return Carbon::parse($time)->format('g:i A');
}
public function getFulldateModalAttribute()
{
    return $this->attributes['FechaModal'].' '. $this->attributes['HoraModal'];
}



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2TtpuWG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire