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,370 points
1,877 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
• 26,740 points
0 votes

Input::get('var_name')

answered Feb 14, 2019 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,370 points
1,415 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
• 26,740 points
1,003 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
• 26,740 points
946 views
+1 vote
1 answer

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

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,427 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
1,922 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
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
• 26,740 points
755 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
• 26,740 points
797 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP