title: Laravel5: Change PHP session to laravel
body: <p>Change PHP session code to laravel session.</p>
  
  <p>I want to put the item_code passed to the GET into the basket session when the value of status is exceeded by the basket.</p>
  
  <p>It would be easy to think of the logic as shopping mall purchase logic. When the user makes a favorite of 4 items, the value of item_code passed to the basket session is returned by the amount of the item. If the user clicks on the bookmark with the item quantity set to 1, the item_code value passed to the basket session is inserted immediately.</p>
  
  <p>I've tried, but I can not keep up with sessions. Help.</p>
  
  <pre><code>switch (trim($_GET['status'])) {
      case "":
          break;
      case "basket":
          if ($_GET['amount'] &gt; 1) {
              for ($i = 1; $i &lt;= $_POST['amount']; $i++) {
                  $_SESSION['basket'][] = $_GET['item_code'];
              }
          } else {
              $_SESSION['basket'][] = $_GET['item_code'];
          }
          break;
  }
  </code></pre>