title: laravel Shopping Cart Call to a member function has() on null (0)
body: <p>this problem occurs when I used Darryldecode\Cart
   the edit() method
      public function edit($id)
      {</p>
  
  <pre><code>  $product=Product::find($id);
  
  //  Cart::add(455, 'Sample Item', 100, 2, array());
  
  
    Cart::add($id,$product-&gt;name,1,$product-&gt;price,['type'=&gt;'PDF']);
  
    return back();
  </code></pre>
  
  <p>and the cart/index.blade.php</p>
  
  <pre><code>&lt;table class="table table-hover"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Name&lt;/th&gt;
        &lt;th&gt;Price&lt;/th&gt;
        &lt;th&gt;qty&lt;/th&gt;
        &lt;th&gt;Type&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      @foreach($cartItems as $cartItem)
      &lt;tr&gt;
        &lt;td&gt;{{$cartItem-&gt;name}}&lt;/td&gt;
        &lt;td&gt;{{$cartItem-&gt;price}}&lt;/td&gt;
  
        &lt;td&gt;{{$cartItem-&gt;qty}}&lt;/td&gt;
        &lt;td&gt;{{$cartItem-&gt;options-&gt;has('type')?$cartItem-&gt;options-&gt;type:''}}&lt;/td&gt;
  
      &lt;/tr&gt;
      @endforeach
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>so I have this problem and want to solve it</p>
  
  <blockquote>
    <p>ErrorException (E_ERROR) Call to a member function has() on null</p>
  </blockquote>
  
  <p>and it wants validation required 
  what should I do?</p>