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

46 lines
1.3 KiB
PHP

<?php
namespace App\Admin\Forms\Settings;
use App\Models\Setting;
use Dcat\Admin\Widgets\Form;
use Illuminate\Support\Arr;
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')->first();
$this->switch('is_use', '是否启用')->value(Arr::get($appSettings?->value, 'is_use', 0));
$this->divider();
$this->text('app_key', 'APP_KEY')->value(Arr::get($appSettings?->value, 'app_key', ''));
$this->text('customer', 'CUSTOMER')->value(Arr::get($appSettings?->value, 'customer', ''));
$this->text('secret', 'SECRET')->value(Arr::get($appSettings?->value, 'secret', ''));
$this->text('userid', 'USER_ID')->value(Arr::get($appSettings?->value, 'userid', ''));
$this->text('callback_uri', '回调地址(链接)')->value(Arr::get($appSettings?->value, 'callback_uri', ''));
}
}