6
0
Fork 0
jiqu-library-server/app/Admin/Forms/Settings/Kuaidi100.php

45 lines
1.2 KiB
PHP

<?php
namespace App\Admin\Forms\Settings;
use App\Models\Setting;
use Dcat\Admin\Widgets\Form;
class Kuaidi100 extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
Setting::where('key', 'kuaidi100')->updateOrCreate([
'key' => 'kuaidi100',
], ['value' => $input]);
return $this
->response()
->success('配置更新成功!')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$appSettings = Setting::where('key', 'kuaidi100')->value('value');
$this->switch('is_use', '是否启用')->value($appSettings['is_use'] ?? 0);
$this->divider();
$this->text('app_key', 'APP_KEY')->value($appSettings['app_key'] ?? '');
$this->text('customer', 'CUSTOMER')->value($appSettings['customer'] ?? '');
$this->text('secret', 'SECRET')->value($appSettings['secret'] ?? '');
$this->text('userid', 'USER_ID')->value($appSettings['userid'] ?? '');
$this->text('callback_uri', '回调地址(链接)')->value($appSettings['callback_uri'] ?? '');
}
}