title: How to push an array to an existing session in laravel
body: <p>Prior to my previous question I have come up with another idea to push array of items in a single session</p>
  
  <p>For instance I have a session <code>session('products')</code></p>
  
  <p>Now what I have, are sets of items for instance.</p>
  
  <pre><code>Name=Item1
  Class=Good
  
  Name=Item2
  Class=Bad
  
  Name=Item3
  Class=Good
  
  Name=Item4
  Class=Bad
  </code></pre>
  
  <p>I learnt that </p>
  
  <pre><code>session()-&gt;put('products.name', $name);
  session()-&gt;put('products.class', $class);
  </code></pre>
  
  <p>This would simply put items to it but When I try to put another array to session, it just replaces the values, </p>
  
  <p>Thus I tried to use <code>push()</code> method </p>
  
  <pre><code>session()-&gt;push('products.name', $name);
  session()-&gt;push('products.class', $class);
  </code></pre>
  
  <p>But it shows that <code>[] operator not supported for strings</code> Does anyone have solution to this?</p>
  
  <p>I am new to laravel and learning! </p>