<?php namespace App\Admin\Forms; use App\Models\User; use Dcat\Admin\Widgets\Form; use Dcat\Admin\Contracts\LazyRenderable; use Dcat\Admin\Traits\LazyWidget; class UserCheckForm extends Form implements LazyRenderable { use LazyWidget; /** * Handle the form request. * * @param array $input * * @return mixed */ public function handle(array $input) { $status = (int)$input['status']; $order = User::find($this->payload['id']); $order->status = $status; $order->save(); return $this->response()->success('确认成功')->refresh(); } /** * Build a form here. */ public function form() { $this->radio('status', '状态')->options([1 => '通过', 2 => '驳回'])->default(1)->required(); } /** * The data of the form. * * @return array */ public function default() { // 获取外部传递参数 return []; } }