import option automatically if exists
This commit is contained in:
parent
4a862c6ecc
commit
0e5d18c0a1
@ -15,6 +15,12 @@ class Option
|
||||
if (!is_null($default_value)) {
|
||||
return $default_value;
|
||||
} else {
|
||||
$options = require BASE_DIR."/setup/options.php";
|
||||
|
||||
if (array_key_exists($key, $options)) {
|
||||
self::add($key, $options[$key]);
|
||||
return $options[$key];
|
||||
}
|
||||
throw new Exception('Unexistent option.', 1);
|
||||
}
|
||||
}
|
||||
@ -39,7 +45,7 @@ class Option
|
||||
return true;
|
||||
|
||||
$option = new OptionModel;
|
||||
$option->option_name = $key;
|
||||
$option->option_name = $key;
|
||||
$option->option_value = $value;
|
||||
$option->save();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user