|
|
|
@ -0,0 +1,56 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace App\Admin\Forms; |
|
|
|
|
|
|
|
use App\Traits\WithdrawalTraits; |
|
|
|
use Dcat\Admin\Widgets\Form; |
|
|
|
|
|
|
|
class ServicePersonsSetting extends Form |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Handle the form request. |
|
|
|
* |
|
|
|
* @param array $input |
|
|
|
* |
|
|
|
* @return mixed |
|
|
|
*/ |
|
|
|
public function handle(array $input) |
|
|
|
{ |
|
|
|
$system = \App\Models\SystemSetting::query()->firstOrCreate([ |
|
|
|
'key' => 'single' |
|
|
|
]); |
|
|
|
|
|
|
|
$arr = [ |
|
|
|
'price' => $input['price'], |
|
|
|
]; |
|
|
|
$system->value = $arr; |
|
|
|
$system->save(); |
|
|
|
return $this |
|
|
|
->response() |
|
|
|
->success('设置成功') |
|
|
|
->refresh(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Build a form here. |
|
|
|
*/ |
|
|
|
public function form() |
|
|
|
{ |
|
|
|
$this->decimal('price','单人头交易费')->rules('required|numeric|min:0|not_in:0',[ |
|
|
|
'*' => '金额为必填字段且必须大于0', |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* The data of the form. |
|
|
|
* |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
public function default() |
|
|
|
{ |
|
|
|
$system = \App\Models\SystemSetting::query()->where('key','single')->value('value'); |
|
|
|
return [ |
|
|
|
'price' => $system['price'] ?? 0, |
|
|
|
]; |
|
|
|
} |
|
|
|
} |