Accessors and Mutators in Laravel 5.3

0

How do I run my own method in Laravel 5.3 Accessors and Mutators? It works with PHP's own methods, but if I try to use a method of mine, it gives error.

I've tried it like this:

public function getUsuTelefoneAttribute($value) {
    $generalInfo = new GeneralInfo();
    $this->attributes['usu_telefone'] = $generalInfo->masc_tel($value);
}

and I tried this way:

public function getUsuTelefoneAttribute($value, GeneralInfo $generalInfo) {
    $this->attributes['usu_telefone'] = $generalInfo->masc_tel($value);
}

but both give error

    
asked by anonymous 08.12.2017 / 19:35

0 answers