roleAllow(UserRole::NORMAL_ADMIN); } protected function getParam(): IParam { return $this->param; } protected function run(Request $request): JsonResponse { $param = $this->param; try { $this->transaction->beginTransaction(); // 顧客情報取得 $customer = collect(API::getCustomers($param->customerCode)) ->where('customer_code', $param->customerCode) ->firstOrFail(); // 駐車場情報取得 $parking = collect(API::getParkings($param->customerCode, $param->parkingManagementCode)) ->where('parking_management_code', $param->parkingManagementCode) ->firstOrFail(); $orderData = [ ...$param->toArray(), HT::COL_NAME_CUSTOMER_NAME => $customer['name'], HT::COL_NAME_PARKING_NAME => $parking['name'], Order::COL_NAME_HANDLER_ID => Auth::id(), Order::COL_NAME_SUMMARY_KEY1 => $param->customerCode, Order::COL_NAME_SUMMARY_KEY2 => $param->parkingManagementCode, Order::COL_NAME_RECEIPT_PURPOSE => "駐車領収証", Order::COL_NAME_RECEIPT_INVOICE_NO => $customer['invoice_no'], Order::COL_NAME_RECEIPT_PURPOSE => "駐車料金", Order::COL_NAME_RECEIPT_ISSUER => $customer['name'], Order::COL_NAME_RECEIPT_SHOP_NAME => $parking['name'], Order::COL_NAME_RECEIPT_PURPOSE => "駐車料金", Order::COL_NAME_MEMO => "駐車料金", ]; logger($orderData); $messages = $this->manager->init() ->fill($orderData) ->create(); if (count($messages) !== 0) { return $this->failedResponse([], $messages); } $this->transaction->commit(); } catch (Exception $e) { $this->transaction->rollBack(); throw $e; } return $this->successResponse(); } }