can('dcat.admin.after_sales.revoke'); } /** * Handle the form request. * * @param array $input * * @return mixed */ public function handle(array $input) { $afterSale = AfterSale::findOrFail($this->payload['id']); if ($afterSale->isCancelled()) { return $this->response()->error('售后单已取消'); } if ($afterSale->isFinished()) { return $this->response()->error('售后单已完成'); } $afterSale->update([ 'state' => AfterSale::STATE_CANCEL, 'remarks' => $input['remarks'] ?? null, ]); return $this->response() ->success(__('admin.update_succeeded')) ->refresh(); } /** * Build a form here. */ public function form() { $this->text('remarks', '备注'); $this->confirm('是否关闭售后单?', '该操作不可逆,确认后将取消售后单。'); } }