4 years ago

Design problem with accessor and mutators

Posted 4 years ago by giopetris

Hello everyone,

I'm using accessors to change the value when the same is filled in the form.


public function getValueAttribute()
    $moneyDataTransformer = new MoneyDataTransformer();

    return $moneyDataTransformer->transform($this->attributes['value']); // The mask is applied here, example: $ 44.21

The problem is, when I want the value without the mask, I should revert the mask in everywhere //: I already think in make a method at my model like "getValuePure()" (FOR EXAMPLE)

My question is, someone has the same problem? How do you make that?

Sorry for my english (:

Please sign in or create an account to participate in this conversation.