title: Laravel Session Flash persists for 2 requests
body: <p>Recently I have changed to Laravel from Codeigniter, everything was going fine except I encountered a problem with <code>Session::flash</code>.</p>
  
  <p>when I create new user I get success message but It will persist for 2 requests, even I didn't pass the validator:
  <img src="https://i.stack.imgur.com/aDuFV.png" alt="enter image description here"></p>
  
  <p>my code in <code>UsersController</code>:</p>
  
  <pre><code>function getCreateUser(){
      $config = array(
          'pageName' =&gt; 'createUser',
          'pageTitle' =&gt; 'Create User',
          'formUrl'   =&gt; action('UsersController@postCreateUser'),
          'modelFields'   =&gt; array(
              array('db_name' =&gt; 'employee_id', 'text' =&gt; 'Employee Id', 'mandatory' =&gt; TRUE),
              array('db_name' =&gt; 'full_name', 'text' =&gt; 'Full Name', 'mandatory' =&gt; TRUE),
              array('db_name' =&gt; 'email', 'text' =&gt; 'Email', 'mandatory' =&gt; FALSE),
              array('db_name' =&gt; 'password', 'text' =&gt; 'Password','value' =&gt; '12345', 'mandatory' =&gt; TRUE)
              ),
          'submit_text' =&gt; 'Create'
          );
      return View::make('layouts.form', $config);
  }
  
  function postCreateUser(){
      $config = array(
          'pageName' =&gt; 'createUser',
          'pageTitle' =&gt; 'Create User',
          'formUrl'   =&gt; action('UsersController@postCreateUser'),
          'modelFields'   =&gt; array(
              array('db_name' =&gt; 'employee_id', 'text' =&gt; 'Employee Id', 'mandatory' =&gt; TRUE),
              array('db_name' =&gt; 'full_name', 'text' =&gt; 'Full Name', 'mandatory' =&gt; TRUE),
              array('db_name' =&gt; 'email', 'text' =&gt; 'Email', 'mandatory' =&gt; FALSE),
              array('db_name' =&gt; 'password', 'text' =&gt; 'Password','value' =&gt; '12345', 'mandatory' =&gt; TRUE)
              ),
          'submit_text' =&gt; 'Create'
          );
      $validator = User::validate(Input::all());
      if($validator-&gt;passes()){
          $user = new User(Input::all());
          $user-&gt;password = Hash::make(Input::get('password'));
          $user-&gt;Company_id = '1';
          $user-&gt;save();
  
          Session::flash('message', 'User Created Successfully!'); 
          Session::flash('alert-class', 'alert-success');
          return View::make('layouts.form', $config);
      } 
  
      return View::make('layouts.form', $config)-&gt;withErrors($validator-&gt;messages());
  }
  </code></pre>
  
  <p>in <code>form.blade</code>:</p>
  
  <pre><code>@if ( $errors-&gt;count() &gt; 0 )
  &lt;div class="alert alert-danger"&gt;
      &lt;p&gt;The following errors have occurred:&lt;/p&gt;
  
      &lt;ul&gt;
          @foreach( $errors-&gt;all() as $message )
          &lt;li&gt;{{ $message }}&lt;/li&gt;
          @endforeach
      &lt;/ul&gt;
  &lt;/div&gt;
  @endif
  </code></pre>
  
  <p>in <code>master.blade</code>:</p>
  
  <pre><code>@if(Session::has('message'))
  &lt;p class="alert {{ Session::get('alert-class', 'alert-info') }} alert-dismissable"&gt; {{ Session::get('message') }}&lt;/p&gt;
  @endif
  </code></pre>
  
  <p>Maybe I'm not alone with this issue, <a href="https://stackoverflow.com/questions/14517809/laravels-flash-session-stores-data-twice/14520060#14520060">here</a> is another unanswered question.</p>
  
  <h2>Update</h2>
  
  <p>For anyone in future facing this problem: 
  <strong>Never flash session data without redirecting.</strong></p>
  
  <p>My code now looks like this:</p>
  
  <pre><code>function postCreateUser(){
      $validator = User::validate(Input::all());
      if($validator-&gt;passes()){
          $user = new User(Input::all());
          $user-&gt;password = Hash::make(Input::get('password'));
          $user-&gt;Company_id = '1';
          $user-&gt;save();
  
          Session::flash('message', 'User Created Successfully!'); 
          Session::flash('alert-class', 'alert-success');
      } else {
          Session::flash('message', Helpers::formatErrors($validator-&gt;messages()-&gt;all()));
          Session::flash('alert-class', 'alert-danger');
      }
  
      return Redirect::action('UsersController@getCreateUser');
  }
  </code></pre>