An Elegant Way to Persist Laravel Input Data to the Session
<p>I'm trying to find if there is an elegant way to pass data from the request->input() into the request->session(); . What I'm trying to achieve is to receive user input which I'd like to then reuse in subsequent http requests.</p>

<p><strong>The Ugly Way:</strong></p>

<p>I can do this in an ugly way:</p>

<pre><code>$request-&gt;session()-&gt;put('name', $request-&gt;input('name'));
$request-&gt;session()-&gt;put('address', $request-&gt;input('address'));
$request-&gt;session()-&gt;put('age', $request-&gt;input('age'));
$request-&gt;session()-&gt;put('bed_time', $request-&gt;input('bed_time'));
</code></pre>

<p><strong>The Laravelly Way:</strong></p>

<p>But that doesn't seem very Laravelly, I feel like there should be a way so that I could do something like:</p>

<pre><code>$request-&gt;input()-&gt;persist();
</code></pre>

<p>or</p>

<pre><code>$request-&gt;persistInput();
</code></pre>

<p>Unfortunately I can't find anything in the docs that gives me a nicer way to implement this. Is there a way to achieve this? Or am I stuck with this ugly unlaravelly way of persisting data into the session?</p>

<hr>

<p><strong>Edit :</strong></p>

<p>I've accepted <a href="https://stackoverflow.com/a/37534558/1700106">Jeff's answer</a> as the solution to my problem. Which partially details the Laravelly way of approaching this problem.</p>

<pre><code>$request-&gt;flash();
</code></pre>

<p>Above is the solution on the request that received the input data. However in all subsequent http requests I need to include the following, and access the data like such.</p>

<pre><code>//This makes the data available for the next request.
$request-&gt;reflash();

// I can access the data from the last request using the 'old' method.
$name = $request-&gt;old('name');
$address = $request-&gt;old('address');
</code></pre>

<p>I need to reflash everytime I want to pass the data down the line another request.</p>