mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Fix missing settings data from site edit page (add back __get function)
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user