mercredi 13 octobre 2021

How to display json collection data convert in array in display in blade file laravel

I want to display json data into the blade file . I am getting data in json format. I am not getting how to convert json data and display

Below is my contoller :

$item = Item::where('active_status', 1)->where('status', "1");
$formats = DB::table('items')->select('format')->distinct()->get();
$fps = DB::table('items')->select('fps')->distinct()->get();

return view('frontend.pages.explore', compact('data','formats','fps'));
         

Blade file as follows:

    <div class="filter-btn">
    
    @foreach(json_decode($formats, true) as $data)
        
        <a class="btn btn-white-outline display-4" href=""></a>
    @endforeach
   </div>

In i am getting below output :

[{"format":null},{"format":"4K"},{"format":"HD"}]

SO i want display this value in tag.

Anyone have idea then let me know



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire