54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
||
|
||
namespace App\Admin\Forms;
|
||
|
||
use Carbon\Carbon;
|
||
use Dcat\Admin\Widgets\Form;
|
||
|
||
class UserSetting extends Form
|
||
{
|
||
/**
|
||
* Handle the form request.
|
||
*
|
||
* @param array $input
|
||
*
|
||
* @return mixed
|
||
*/
|
||
public function handle(array $input)
|
||
{
|
||
admin_setting($input);
|
||
return $this
|
||
->response()
|
||
->success('配置更新成功!')
|
||
->refresh();
|
||
}
|
||
|
||
/**
|
||
* Build a form here.
|
||
*/
|
||
public function form()
|
||
{
|
||
$this->multipleSelect('register_ticket', '绑定手机号领券')
|
||
->options(admin_route('quan_ticket.api'))
|
||
->saving(function ($value) {
|
||
// 转化成json字符串保存到数据库
|
||
return json_encode($value);
|
||
})->default(admin_setting('register_ticket'));
|
||
|
||
$this->table('user_rank', '会员等级', function ($table) {
|
||
$table->text('rank_name','等级名称')->required();
|
||
// $table->image('rank_icon', '等级图片')
|
||
// ->accept('jpg,png,gif,jpeg', 'image/*')
|
||
// ->move('milk-tea/user_setting/'.Carbon::now()->toDateString())
|
||
// ->saveFullUrl()->removable(false)
|
||
// ->required()->help('建议图片尺寸:16*16');
|
||
$table->number('rank_limit', '等级门槛')->attribute('min', 0);;
|
||
})->saving(function ($value) {
|
||
$value = collect($value)->sortBy('rank_limit')->toArray();
|
||
// dd($value);
|
||
return json_encode($value);
|
||
})->default(admin_setting('user_rank'));
|
||
|
||
}
|
||
}
|