Skip to content

Commit

Permalink
make sure mutators get called on the model before setting attributes …
Browse files Browse the repository at this point in the history
…value
  • Loading branch information
mjauvin committed Feb 27, 2024
1 parent d9ff4e0 commit 3132dfe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/system/behaviors/SettingsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
use App;
use Artisan;
use Cache;
use Log;
use Exception;
use Log;
use Illuminate\Database\QueryException;
use Str;
use System\Classes\ModelBehavior;

/**
Expand Down Expand Up @@ -180,6 +181,11 @@ public function setSettingsValue($key, $value)
return;
}

if ($this->model->hasSetMutator($key)) {
$mutator = 'set'.Str::studly($key).'Attribute';
$value = $this->model->{$mutator}($value);
}

$this->fieldValues[$key] = $value;
}

Expand Down

0 comments on commit 3132dfe

Please sign in to comment.