2023-11-17 01:44:01 -05:00
|
|
|
<?php
|
2024-04-09 12:51:03 -04:00
|
|
|
use App\Support\Setting;
|
2023-11-17 01:44:01 -05:00
|
|
|
|
|
|
|
if (! function_exists('admin_setting')) {
|
|
|
|
/**
|
|
|
|
* 获取或保存配置参数.
|
|
|
|
*
|
|
|
|
* @param string|array $key
|
|
|
|
* @param mixed $default
|
|
|
|
* @return App\Support\Setting|mixed
|
|
|
|
*/
|
|
|
|
function admin_setting($key = null, $default = null)
|
|
|
|
{
|
|
|
|
if ($key === null) {
|
2024-04-09 12:51:03 -04:00
|
|
|
return App::make(Setting::class)->toArray();
|
2023-11-17 01:44:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (is_array($key)) {
|
2024-04-09 12:51:03 -04:00
|
|
|
App::make(Setting::class)->save($key);
|
|
|
|
return '';
|
2023-11-17 01:44:01 -05:00
|
|
|
}
|
|
|
|
$default = config('v2board.'. $key) ?? $default;
|
2024-04-09 12:51:03 -04:00
|
|
|
return App::make(Setting::class)->get($key) ?? $default ;
|
2023-11-17 01:44:01 -05:00
|
|
|
}
|
|
|
|
}
|