title: Trying to get property 'name' of non-object in laravel
body: <p>Trying to get property 'name' of non-object in laravel while am getting products from whmcs using api
  This is my json data from whmcs api</p>
  
  <pre><code>"products": {
  "product": [
  {
  "pid": "1",
  "gid": "1",
  "type": "hostingaccount",
  "name": "super lite",
  "description": "1 website",
  "module": "cpanel",
  "paytype": "recurring",
  "pricing": {
    "INR": {
      "prefix": "\u20b9",
      "suffix": "INR",
      "msetupfee": "0.00",
      "qsetupfee": "0.00",
      "ssetupfee": "0.00",
      "asetupfee": "0.00",
      "bsetupfee": "0.00",
      "tsetupfee": "0.00",
      "monthly": "-1.00",
      "quarterly": "-1.00",
      "semiannually": "-1.00",
      "annually": "1668.00",
      "biennially": "3096.00",
      "triennially": "3924.00"
    }
  </code></pre>
  
  <p>This is my controller code</p>
  
  <pre><code>class GetProductController extends Controller
  {
  public function show(){
  
      $products = Whmcs::GetProducts([
          'pid',
          'name',
          'price',
          'description'
  
  
      ]);
  
      return view('main.SME_Hosting',['products'=&gt;$products]);
     }
      }
  </code></pre>
  
  <p>This is my view code</p>
  
  <pre><code>@foreach ($products as $product)
            {{$product-&gt;name}}              
  
  @endforeach
  </code></pre>
  
  <p>This is my route</p>
  
  <pre><code>Route::get('SME_Hosting','GetProductController@show'); 
  </code></pre>