"{$orderItemsPath}.{$relation}", self::RELATIONS); } public function toArray(Request $request): array { return [ 'id' => $this->id, 'server_name' => $this->server_name, 'domain_name' => $this->domain_name, 'product' => $this->product ? [ 'id' => $this->product->id, 'name' => $this->product->name, 'product_type' => $this->product->product_type, ] : null, 'service' => $this->service ? [ 'id' => $this->service->id, 'vm_id' => $this->service->vm_id, 'server_name' => $this->service->server_name, 'type' => $this->service->type, 'status' => $this->service->status, 'started_at' => $this->service->started_at, 'expires_at' => $this->service->expires_at, ] : null, ]; } }