Hi Im using Laravel 8 And Im new here and struggling so much .
On my Controller I have this .
$coinsphapi = json_decode(Http::get('https://quote.coins.ph/v1/markets'));
I only want to get The bid of BTC-ETH But I dont know how to show the number data of bid .
I tried
@foreach ($coinsphapi->markets as $item)
{{$item->bid}}
But it shows the entire symbol on the api
CodePudding user response:
You should use:
@foreach ($coinsphapi->markets as $key => $item)
In this case $key
is the bid.
CodePudding user response:
As they point out in their API Documentation, you can call the market value for a specific currency like BTC-ETH
$coinsphapi = json_decode(Http::get('https://quote.coins.ph/v1/markets/BTC-ETH'));
Then echo the bid directly without looping
{{$coinsphapi->market->bid}}