Fix missing settings data from site edit page (add back __get function)

This commit is contained in:
DariusIII
2024-07-03 23:09:27 +02:00
parent 525ad23e57
commit c7c8287311
+19
View File
@@ -109,6 +109,25 @@ class Settings extends Model
protected static $settingsCollection;
/**
* Adapted from https://laravel.io/forum/01-15-2016-overriding-eloquent-attributes.
*
* @return mixed
*/
public function __get($key)
{
$override = self::query()->where('name', $key)->first();
// If there's an override and no mutator has been explicitly defined on
// the model then use the override value
if ($override && ! $this->hasGetMutator($key)) {
return $override->value;
}
// If the attribute is not overridden the use the usual __get() magic method
return parent::__get($key);
}
/**
* Return a tree-like array of all or selected settings.
*