Laravel 5.4 to get data form API response

0 votes

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'
        ));
}

Its not working,

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

{{ $BTCSellPrice }}
{{ $BTCSellPrice->amount }}
{{ $BTCSellPrice['amount'] }}
{{ $BTCSellPrice[0] }}

But keep on getting errors, like:

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

How to do it?

Aug 27, 2018 in Blockchain by slayer
• 29,050 points
201 views

2 answers to this question.

0 votes

Ok I found the class object being returned and figured out what you need from https://github.com/coinbase/coinbase-php/blob/master/src/Value/Money.php

{{ $BTCSellPrice->getAmount() }}
{{ $BTCSellPrice->getCurrency() }}
answered Aug 27, 2018 by digger
• 27,620 points
0 votes

Input::get('var_name')

answered Feb 14 by anonymous
Where do I add this line?

Related Questions In Blockchain

0 votes
1 answer

How to get data from Google Finance to Google sheets?

You need to have a from and ...READ MORE

answered Aug 21, 2018 in Blockchain by slayer
• 29,050 points
92 views
0 votes
1 answer

How to get iota balance via api url?

Either run your own node (thus, the localhost reference ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 27,620 points
81 views
0 votes
1 answer

Nodejs: How to pass user form data into defined class

This should do your work: // select the ...READ MORE

answered Sep 19, 2018 in Blockchain by digger
• 27,620 points
29 views
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,320 points
56 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
105 views
0 votes
1 answer
0 votes
1 answer

How to get property of non object in Coinbase API

First, your sendMoney() call is stored into ...READ MORE

answered Aug 31, 2018 in Blockchain by digger
• 27,620 points
27 views
0 votes
1 answer

What encoding or data type can be used to get alphanumeric string in elixir?

Integers in Elixir are arbitrary precision integers, ...READ MORE

answered Aug 31, 2018 in Blockchain by digger
• 27,620 points
39 views