How to redirect back to form with input

Return from controller

return Redirect::back()->withErrors($validator)->withInput();

View part

<input type="text" class="form-control" name="name" value="{{ old('name') }}">
@if($errors->has('name')) 
                        <p class="alert alert-danger print-error-msg"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
                              {{ $errors->first('name') }}
                        </p>
                        @endif
Leave a Comment