diff --git a/app/DotsAPI/Fetcher/v2/ApiFetcher.php b/app/DotsAPI/Fetcher/v2/ApiFetcher.php index c025725..9491a46 100644 --- a/app/DotsAPI/Fetcher/v2/ApiFetcher.php +++ b/app/DotsAPI/Fetcher/v2/ApiFetcher.php @@ -6,7 +6,7 @@ use GuzzleHttp\Client; class ApiFetcher { - public function get($endpoint) { + public function get($endpoint, $field = 'items') { $client = new Client(); $baseUrl = config('dotsapi.base_url'); @@ -31,8 +31,10 @@ class ApiFetcher ); $data = json_decode($response->getBody()->getContents(), true); - $items = $data['items']; - return $items; + if($field == '') + return $data; + + return $data[$field]; } }