Comment faire un Trait dans Laravel

Où le fichier faire si je veux utiliser ce trait sur mes Modèles

Comment ce fichier ressemble si je veux avoir ce trait de caractère à l'intérieur:

trait FormatDates
{
    protected $newDateFormat = 'd.m.Y H:i';


    //save the date in UTC format in DB table
    public function setCreatedAtAttribute($date){

        $this->attributes['created_at'] = Carbon::parse($date);

    }

    //convert the UTC format to my format
    public function getCreatedAtAttribute($date){

        return Carbon::parse($date)->format($this->newDateFormat);

    }

    //save the date in UTC format in DB table
    public function setUpdatedAtAttribute($date){

        $this->attributes['updated_at'] = Carbon::parse($date);

    }

    //convert the UTC format to my format
    public function getUpdatedAtAttribute($date){

        return Carbon::parse($date)->format($this->newDateFormat);

    }

    //save the date in UTC format in DB table
    public function setDeletedAtAttribute($date){

        $this->attributes['deleted_at'] = Carbon::parse($date);

    }

    //convert the UTC format to my format
    public function getDeletedAtAttribute($date){

        return Carbon::parse($date)->format($this->newDateFormat);

    }
}

Et comment l'appliquer par exemple à un Utilisateur de la classe du Modèle...

OriginalL'auteur lewis4u | 2016-10-27