title: How do sessions work in Laravel 5
body: <p>I am trying to understand how sessions work in Laravel 5(.4). 
  In one hand there are two ways of using them as described in <a href="https://laravel.com/docs/5.4/session" rel="nofollow noreferrer">the official documentation</a>:</p>
  
  <blockquote>
    <p>There are two primary ways of working with session data in Laravel: the global session helper and via a Request instance.</p>
  </blockquote>
  
  <pre><code>$request-&gt;session()-&gt;put('key', 'value');
  </code></pre>
  
  <p>and</p>
  
  <pre><code>session(['key' =&gt; 'value']);
  </code></pre>
  
  <p>The documentation says:</p>
  
  <blockquote>
    <p>There is little practical difference between using the session via an HTTP request instance versus using the global session helper.</p>
  </blockquote>
  
  <p>But it is never explained what the difference is.</p>
  
  <p>In the other hand there is the "Facade way":</p>
  
  <pre><code>Session::put('key', 'value');
  </code></pre>
  
  <p>And recently I found this Stack Overflow question <a href="https://stackoverflow.com/questions/36952404/how-to-use-session-in-laravel-5-2-controller">How to use session in laravel 5.2 controller</a>. <a href="https://stackoverflow.com/users/2355822/train-fox">train_fox</a> pointed out this way:</p>
  
  <pre><code>session()-&gt;put('key', 'value');
  </code></pre>
  
  <p>So that makes a total of four ways. And I cannot figure out why or when use one or another. Does someone know the difference between those four?</p>
  
  <p>By the way, the only way I could get sessions to work with Redis was with the two last ways.</p>
  
  <p>Thank you in advance for your enlightenment.</p>