mercredi 28 mars 2018

How to decode the json data from WHMCS and display the data using foreach loop in laravel-5.6

The controller code is given below:

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]);


    }
}

The code using foreach is as follows:

@foreach ($products as $product)
           



@endforeach 

I'm getting an error as Expecting string not an array given.. and Undefined variable 'pid'.

The Route code is:

Route::get('SME_Hosting','GetProductController@show'); 

Suggest a solution to decode the json data and display it.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2pLh9Bm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire