I'm using the Twitter Api PHP library which returns the following object fine in my controller:
$tw_trends = $this->twitter->trends();
[
{
"trends": [
{
"name": "Bill Cosby",
"url": "http://twitter.com/search?q=%22Bill+Cosby%22",
"promoted_content": null,
"query": "%22Bill+Cosby%22",
"tweet_volume": 229907
},
...
However, when I pass the $tw_trends
to my view and try and do the following foreach
, I get an error. How can I access the name
value in the above object?
@foreach ($tw_trends as $trend)
<ul>
<li>
{{ $trend->name }}
</li>
</ul>
@endforeach
Error:
Undefined property: stdClass::$name
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire