mardi 27 mars 2018

How to print the json data using foreach loop in laravel-5.6

The Controller code is as follows:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Illuminate\Support\Facades\View;

use DarthSoup\Whmcs\Facades\Whmcs;
use DarthSoup\Whmcs\WhmcsServiceProvider;

class GetProductController extends Controller
{
public function show(){
    $products = Whmcs::GetProducts([
        'pid'=>'pid',
        'name' =>'name',
        'price' =>'price',
        'description' =>'description'


    ]);

    return view('main.SME_Hosting',['products'=>$products]);


    }
}

And in Views I have written code using foreach as follows:

         @foreach ($products as $product)
               <td> </td>
               <td> </td>
               <td> </td>
               <td> </td>

 @endforeach

My Json data is given below: I have attached the screenshot of JSON data and suggest a way to print all these datas using foreach loop.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire