I’m trying to modify a setting during the beforeSave with code that previously worked in October 2 but since updating to October 3 it no longer works.
The code:
Settings::extend(function ($model) {
$model->bindEvent('model.beforeSave', function () use ($model) {
$locations = $model->getSettingsValue('locations');
//code that modifies $locations
$model->setSettingsValue('locations', $locations);
});
});
The issue is that when you try to save the Settings model October runs an sql query like this:
update TABLE_NAME set value = 'all settings (including locations) go here, locations = ‘only locations data goes here’
That sql query fails because the locations column doesn’t exist, which it shouldn’t as far as I’m aware.
Is there some other command I’m supposed to use here instead of setSettingsValue or is no longer possible to update Settings during the beforeSave?