I've some JSON data stored in a field of my DB, to display the data in a view, I wrote this query in my controller
$gallerie = Articolo::select('nome_gal')
->where('nome_gal','LIKE','%nome_gal%')
->orderBy('created_at', 'desc')
->orderBy('updated_at', 'desc')
->take(6)
->get();
In the controller, I pass that query, and other queries, to a view in this way
return view('articoli')->with(array('articoli' => $articoli, 'gallerie'=>$gallerie, 'categorie'=> $categorie, 'trevideo'=>$trevideo, 'treaudio'=>$treaudio));
in the sidebar section of the view I used this code:
<div class="sidebar-item popular">
<h3>Ultime foto</h3>
<ul class="gallery">
@foreach(json_decode($gallerie, true) as $galleria)
<li>{{ $galleria['cover_gal'] }}</li>
@endforeach
</ul>
</div>
Well, as a result, when I try to load the page, I don't see any code under the <ul class="gallery">.
The structure of the JSON data is this http://p4c.it/alfa.json
Considering that json_decode needs a string, in my opinion there is something wrong in the controller part. Do you have any suggestion?