| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace App\Admin\Forms;
- use Dcat\Admin\Widgets\Form;
- use Dcat\Admin\Traits\LazyWidget;
- use Dcat\Admin\Contracts\LazyRenderable;
- // 开礼盒保底设置
- class GiftBoxHit extends Form implements LazyRenderable
- {
- use LazyWidget;
- /**
- * Handle the form request.
- *
- * @param array $input
- *
- * @return mixed
- */
- public function handle(array $input)
- {
- //
- $obj = \App\Models\Config::where("key", "box_hit_cnt")->first();
- if(!$obj) {
- $obj = new \App\Models\Config();
- $obj->key = "box_hit_cnt";
- }
- $obj->val = (int)$input['hit_cnt'];
- $obj->save();
- //
- return $this
- ->response()
- ->success('修改成功')
- ->refresh();
- }
- /**
- * Build a form here.
- */
- public function form()
- {
- //
- $this->number("hit_cnt", "保底次数")->required()->help("到保底次数前还未抽中SSR,则下次必中");
- //
- }
- /**
- * The data of the form.
- *
- * @return array
- */
- public function default()
- {
- //
- return (new \App\Http\Controllers\BoxController())->getBoxHit();
- // $obj = \App\Models\Config::where("key", "box_hit_cnt")->first();
- // if ($obj && $obj->val) {
- // return ['hit_cnt'=>(int)$obj->val];
- // }
- // //
- // return config("avatar.box_hit_cnt");
- }
- }
|