getKey()); $rebate_log = ContractRebate::find($this->getKey()); if ($rebate_log->settle()) { return $this->response() ->success('结算成功: ' . $this->getKey()) ->refresh(); } else { return $this->response() ->error('结算失败: ' . $this->getKey()); } } /** * @return string|array|void */ public function confirm() { return ['确定结算?', '每日12:00系统会自动结算,您可手动提前结算。']; } /** * @param Model|Authenticatable|HasPermissions|null $user * * @return bool */ protected function authorize($user): bool { // 获取当前订单是否已结算 return ContractRebate::find($this->getKey())->value('status') ? false : true; } /** * @return array */ protected function parameters() { return []; } }