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

46 lines
1.1 KiB
PHP

<?php
namespace App\Admin\Forms\Settings;
use App\Models\Setting;
use App\Services\SettingService;
use Dcat\Admin\Widgets\Form;
class Withdraw extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
Setting::where('key', 'withdraw')->updateOrCreate([
'key' => 'withdraw',
], ['value' => $input]);
//清配置缓存
app(SettingService::class)->cleanCache('withdraw');
return $this
->response()
->success('配置更新成功!')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$appSettings = Setting::where('key', 'withdraw')->value('value');
// $this->switch('is_use', '提现开关')->value($appSettings['is_use'] ?? 0);
$this->number('threshold_amount', '起提金额(元)')->value($appSettings['threshold_amount'] ?? 0);
$this->currency('rate', '提现费率')->value($appSettings['rate'] ?? 0)->symbol('%');
}
}