title: Redirect back to URL with variables
body: <p>I'm setting up a "Do you confirm to terms and conditions?" type page with Laravel. The user has to check the box, fill in the current date and submit. The URL they are given will be something like;</p>
  
  <pre><code>example.com/laravel/public/security-agreement/23823jdsjdsreuyr
  </code></pre>
  
  <p>The <code>23823jdsjdsreuyr</code> part is a unique code in the table against that agreement.</p>
  
  <p>My routes file;</p>
  
  <pre><code>Route::get('/security-agreement/{code}',  array('as' =&gt; 'security-agreement','uses' =&gt; 'SecurityAgreementController@getAgreement'));
  
  Route::post('/security-agreement', array('as' =&gt; 'security-agreement','uses' =&gt; 'SecurityAgreementController@postAgreement'));
  </code></pre>
  
  <p>My controller;</p>
  
  <pre><code>public function getAgreement($code) {
    $client_agreement = ClientAgreement::with('agreements')-&gt;where('code', '=', $code)-&gt;first();
    $client = ClientAgreement::with('clients')-&gt;where('code', '=', $code)-&gt;first();
  
    return View::make('contracts.index')
    -&gt;with('client_agreement', $client_agreement)
    -&gt;with('client', $client);
  }
  
  public function postAgreement() {
    $validator = Validator::make(Input::all(), array(
      'start_date' =&gt; 'required|date_format:Y-m-d',
      'accept' =&gt; 'required|accepted'
      ));
  
    if($validator-&gt;fails()) {
      return Redirect::route('security-agreement')
        -&gt;withErrors($validator);
    } else {
       print "success";
    }
  
  }
  </code></pre>
  
  <p>My question is... How do I return the user if they have made errors (if validator fails), and keep the code in the URL? I'm not married to this way of doing it if there is a better way. I just needed a way of making the lookup id unguessable.</p>
  
  <p>I've tried a few different ways of playing around with the routes and also concatenating <code>$code</code> at the <code>Redirect::route</code> point but can't get it to work.</p>