59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Slowlyo\OwlAdmin\Renderers\Tab;
|
|
use Slowlyo\OwlAdmin\Renderers\Tabs;
|
|
use Slowlyo\OwlAdmin\Renderers\TextControl;
|
|
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
|
use App\Admin\Components;
|
|
|
|
class SettingController extends AdminController
|
|
{
|
|
protected string $queryPath = 'system/settings';
|
|
|
|
protected string $pageTitle = '系统设置';
|
|
|
|
public function index()
|
|
{
|
|
$page = $this->basePage()->body($this->form());
|
|
|
|
return $this->response()->success($page);
|
|
}
|
|
|
|
public function form()
|
|
{
|
|
return $this->baseForm()
|
|
->redirect('')
|
|
->api($this->getStorePath())
|
|
->data(settings()->all())
|
|
->panelClassName('')
|
|
->title('')
|
|
->body(
|
|
Tabs::make()->tabs([
|
|
Tab::make()->title('基地信息设置')->body([
|
|
amisMake()->ComboControl('region_base', '基础信息')->multiple(true)->items([
|
|
amisMake()->TextControl('name', '名称'),
|
|
Components::make()->decimalControl('value', '值'),
|
|
amisMake()->TextControl('unit', '单位'),
|
|
])->description('以上明细前6项会展示在大屏中间底部。'),
|
|
]),
|
|
Tab::make()->title('系统设置')->body([
|
|
TextControl::make()->label('RTSP 转流服务')->name('rtsp_url'),
|
|
]),
|
|
])
|
|
);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$data = $request->only([
|
|
'rtsp_url',
|
|
'region_base'
|
|
]);
|
|
|
|
return settings()->adminSetMany($data);
|
|
}
|
|
}
|