Xboard/app/Helpers/Functions.php

26 lines
644 B
PHP
Raw Normal View History

2023-11-17 01:44:01 -05:00
<?php
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) {
return App::make(Setting::class)->toArray();
2023-11-17 01:44:01 -05:00
}
if (is_array($key)) {
App::make(Setting::class)->save($key);
return '';
2023-11-17 01:44:01 -05:00
}
$default = config('v2board.'. $key) ?? $default;
return App::make(Setting::class)->get($key) ?? $default ;
2023-11-17 01:44:01 -05:00
}
}