can('dcat.admin.dealers.bonds'); } /** * Handle the form request. * * @param array $input * * @return mixed */ public function handle(array $input) { $id = $this->payload['id'] ?? 0; try { DB::beginTransaction(); $dealer = Dealer::findOrFail($id); $dealer->update([ 'bonds'=>$input['bonds'], ]); DB::commit(); } catch (Throwable $th) { DB::rollBack(); report($th); return $this->response()->error('操作失败:'.$th->getMessage()); } return $this->response() ->success(__('admin.update_succeeded')) ->refresh(); } /** * Build a form here. */ public function form() { $this->currency('bonds')->required(); } public function default() { $id = $this->payload['id'] ?? 0; $dealer = Dealer::findOrFail($id); return [ 'bonds'=>$dealer->bonds, ]; } }