get('path'); $targetUrl = env('OPEN_PLATFORM_URL') . $path; $method = $request->getMethod(); $headers = $request->headers->all(); $body = $request->getContent(); try { $response = $client->request($method, $targetUrl, [ 'headers' => $headers, 'body' => $body, 'auth' => [ env('OPEN_PLATFORM_USERNAME'), env('OPEN_PLATFORM_PASSWORD') ] ]); $content = json_decode($response->getBody()->getContents(), true); return $this->success(['data' => $content['data']]); } catch (ClientException $e) { $response = $e->getResponse(); $content = json_decode($response->getBody()->getContents(), true); return $this->badRequest($content['message']); } } }