海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.3 KiB

<?php
namespace App\AdminAgent\Forms;
use App\Models\AgentSetting;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Form;
class Setting extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
// dump($input);
AgentSetting::updateOrCreate(
['agent_id' => Admin::user()->id],
['setting' => $input, 'agent_id' => Admin::user()->id],
);
return $this->response()->success('保存成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->text('order_timeout')->required()->default(60)
->help('订单超时时间,单位:分钟。(订金、定金支付的超时时间将根据产品设定的超时时间)');
$this->radio('auto_shelves')->options(['否', '是'])->required()->default(1)
->help('是否自动上架合作供应商的产品,如果选是,当合作供应商发布新产品之后,将自动上架供应商的产品');
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
$setting = AgentSetting::where('agent_id', Admin::user()->id)->value('setting');
return $setting ?? [];
}
}