59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Forms\Settings;
|
|
|
|
use App\Models\Order;
|
|
use App\Models\Setting;
|
|
use App\Services\SettingService;
|
|
use Dcat\Admin\Widgets\Form;
|
|
|
|
class Ios extends Form
|
|
{
|
|
/**
|
|
* Handle the form request.
|
|
*
|
|
* @param array $input
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle(array $input)
|
|
{
|
|
Setting::where('key', 'ios')->updateOrCreate([
|
|
'key' => 'ios',
|
|
], ['value' => $input]);
|
|
|
|
//清配置缓存
|
|
app(SettingService::class)->cleanCache('ios');
|
|
|
|
return $this
|
|
->response()
|
|
->success('配置更新成功!')
|
|
->refresh();
|
|
}
|
|
|
|
/**
|
|
* Build a form here.
|
|
*/
|
|
public function form()
|
|
{
|
|
$appSettings = Setting::where('key', 'ios')->value('value');
|
|
|
|
$this->number('v', '版本号')->min(0)->value($appSettings['v']??0)->help('配置应用最小版本号');
|
|
$this->divider();
|
|
|
|
$this->switch('is_verify', '审核开关')->value($appSettings['is_verify'] ?? 0);
|
|
$this->switch('wallet_show', '账户开关')->value($appSettings['wallet_show'] ?? 0);
|
|
|
|
$this->checkbox('pay_way', '支付方式')->options([
|
|
Order::PAY_WAY_WXPAY => '微信支付',
|
|
Order::PAY_WAY_ALIPAY => '支付宝',
|
|
Order::PAY_WAY_WALLET => '可提',
|
|
Order::PAY_WAY_BALANCE => '余额',
|
|
// Order::PAY_WAY_OFFLINE = 'offline'; // 现金支付
|
|
])->canCheckAll()->customFormat(function () use ($appSettings) {
|
|
// dd($appSettings['pay_way']);
|
|
return $appSettings['pay_way']??[];
|
|
});
|
|
}
|
|
}
|