title: Displaying the Error Messages in Laravel after being Redirected from controller
body: <p><strong>How can I display the validation message in the view that is being redirected in Laravel ?</strong></p>
  
  <p>Here is my function in a Controller</p>
  
  <pre><code>public function registeruser()
  {
      $firstname = Input::get('firstname');
      $lastname = Input::get('lastname');
      $data  =  Input::except(array('_token')) ;
      $rule  =  array(
                  'firstname'       =&gt; 'required',
                  'lastname'         =&gt; 'required',
                     ) ;
      $validator = Validator::make($data,$rule);
      if ($validator-&gt;fails())
      {
      $messages = $validator-&gt;messages();
      return Redirect::to('/')-&gt;with('message', 'Register Failed');
      }
      else
      {
      DB::insert('insert into user (firstname, lastname) values (?, ?)',
                                  array($firstname, $lastname));
      return Redirect::to('/')-&gt;with('message', 'Register Success');
      }
      }
  </code></pre>
  
  <p>I know the below given code is a bad try, But how can I fix it and what am 
   I missing </p>
  
  <pre><code>@if($errors-&gt;has())
      @foreach ($errors-&gt;all() as $error)
          &lt;div&gt;{{ $error }}&lt;/div&gt;
      @endforeach
  @endif
  </code></pre>
  
  <h2>Update : And how do I display the error messages near to the particular fields</h2>