取消订单'; } protected function authorize($user): bool { return $user->can('dcat.admin.offline_orders.revoke'); } public function handle(Request $request) { try { DB::beginTransaction(); $order = OfflineOrder::lockForUpdate()->findOrFail($this->getKey()); if (! $order->isPending()) { throw new BizException('订单状态已更新'); } (new OfflineOrderService())->revoke($order); DB::commit(); } catch (Throwable $th) { DB::rollBack(); report($th); return $this->response()->error('操作失败,'.$th->getMessage())->refresh(); } return $this->response()->success('操作成功')->refresh(); } /** * @return string|array|void */ public function confirm() { return ['是否取消选中订单?']; } }