付款'; /** * @param Model|Authenticatable|HasPermissions|null $user * * @return bool */ protected function authorize($user): bool { return $user->can('dcat.admin.dealer_purchase_subsidies.pay'); } // 确认弹窗信息 public function confirm() { return '您确定要支付选中的进货补贴吗?'; } // 处理请求 public function handle(Request $request) { DB::transaction(function () { $id = $this->getKey(); $dealerPurchaseSubsidy = DealerPurchaseSubsidy::lockForUpdate()->settleCompleted()->findOrFail($id); (new DealerEarningService())->pay( $dealerPurchaseSubsidy->earning->setRelation('earningable', $dealerPurchaseSubsidy) ); }); return $this->response()->success('操作成功')->refresh(); } }