海南旅游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.
 
 
 

49 lines
1.2 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' => json_encode($input), 'agent_id' => Admin::user()->id],
);
return $this->response()->success('保存成功')->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$this->text('earnest')->required()->help('用户支付订金、定金、首付款的金额');
$this->text('earnest_timeout')->required()->help('单位:分钟。当通过订金、定金、首付款支付时,用户超过该时间未支付将关闭订单,且定金不退');
}
/**
* The data of the form.
*
* @return array
*/
public function default()
{
$setting = AgentSetting::where('agent_id', Admin::user()->id)->value('setting');
return is_string($setting) ? json_decode($setting, true) : [];
}
}