title: Laravel - Call to a member function save() on string
body: <p>I am unable to save an array of items from session to mysql database with an error:</p>
  
  <p><code>"Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
    Call to a member function save() on string"</code></p>
  
  <p>When I do a dd(Dump and Die) the array is displayed as below:</p>
  
  <pre><code>    "{"1":{"name":"Bajiya","quantity":4,"price":"34.00"},
      "2":{"name":"Gulha","quantity":2,"price":"3.00"},
      "3":{"name":"kavaabu","quantity":1,"price":"2.00"}}"
  </code></pre>
  
  <p>Below is the controller store function:</p>
  
  <pre><code>public function storeCart(Request $request){
  
      $cart = new Cart;
      $cart= session()-&gt;get('cart');
      $cart =  json_encode($cart);
      $cart-&gt;save();
  }
  </code></pre>
  
  <p>I have a table in my Database with columns for id and cart. I want the array above to be saved in the cart column.</p>
  
  <p>Thanks</p>