Closed SomosAMambo closed 7 years ago
That is by design but I'm open to rethinking it. Here is where this happens:
https://github.com/BKWLD/decoy/blob/master/classes/Models/Base.php#L121-L143
My thinking when adding this was that mutators are added to the model to affect the rendering of data on the public site but the admin should interact with the raw, true data from the database.
But yeah, I'm open to removing it. What do you think?
I think removing it completely is to radical and can cause unexpected problem on current projects. Maybe a property/param on model basis to switch off this default behavior?
Yeah, like maybe a param that allows you to whitelist some params for either get or set. That sounds good.
Like this:
/**
* Uploadable attributes
*
* @var array
*/
protected $upload_attributes = ['file'];
When a attribute has a mutator, like a money field which save in db like
123456.78
but when accessed it should show$ 123,456.78
, for example, but in the edit form, it doesn't pass trough the mutator (e.g.:getMoneyAttribute
where money is the attribute/field name). And, when saving/creating the model, the mutator/setter (e.g.:setMoneyAttribute
) is being ignored as well.