Sunday, May 21, 2017

Need to get data from API response - Laravel 5.4

Im using an API, and I need to display the data in my blade view. Im having trouble doing that. This is what I have in my controller:

public function index() {

    // secret ....
    // key....

    $configuration = Configuration::apiKey($apiKey, $apiSecret);
        $client = Client::create($configuration);

        $BTCSellPrice = $client->getSellPrice('BTC-USD');
        dd($BTCSellPrice);

    return view('welcome', compact(
            'BTCSellPrice'
        ));
}

I get back this:

enter image description here

I tried calling it in the front-end these ways:






But keep on getting errors, like:

Cannot use object of type Coinbase\Wallet\Value\Money as array 

Do I need to pass it through a collection or something?



via David

Advertisement