<?php

namespace App\Helpers;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Storage;


Class Apihelpers
{
    
    
    public static function review_api($locatorID=null)
    {
        $file = Storage::disk('public')->exists('key/apikey.dba');
        if($file == true){
            $api_key = Storage::get('key/apikey.dba');
        }
        
        $api = config('app.api').$locatorID.'/reviews';
        $client = new Client();
        $response = $client->request('GET', $api,[ 'headers' => [
            'Accept'     => 'application/json',
            'Authorization'  => $api_key]
        ]);
    	$statusCode = $response->getStatusCode();
        $body = $response->getBody()->getContents();
        return $locationDetailAPIdata = json_decode($body,true);
    }

}