From laravel 4 documentation
Note that when validation fails, we pass the Validator instance to the Redirect using the withErrors method. This method flashes the error messages per session so that they are available on the next request.
The $errors variable is not an array.
The $errors variable will be an instance of MessageBag .
For some reason, I don't really like the @seamlss idea. Instead, you can use this .
@if(Session::has('errors')) <? $errors = Session::get('errors'); ?> <div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> <ul> <li id="form-errors" > <h3> {{ $errors->first('email') }}</h3> </li> </ul> </div> @endif
I used some bootstrap components, do not get confused, the only thing you need is lines with curly braces and a magic @ sign.
From laravel docs error-messages-and-views
So, it is important to note that the $ errors variable will always be available in all your views, for each request, which makes it convenient to assume that the $ errors variable is always defined and can be used safely.
You can also check this.
@if( $errors->has('email') ) <div class="control-group error"> <label class="control-label" for="email">Email</label> <div class="controls"> <input type="text" id="email" placeholder="Email" name="email"> <span class="help-inline">{{ $errors->first('email') }}</span> </div> </div> @endif
source share