Entrance to the old Laravel 5 is empty

My routes are here

Route::get('sign-up', ['as' => 'signUp', 'uses' => ' UserController@signUpGet ']); Route::post('sign-up', ['as' => 'signUpPost', 'uses' => ' UserController@signUpPost ']); 

controller

 return redirect('signUp')->withInput(); 

And View

  <form role="form" method="POST" action="{{route('signUpPost')}}"> <input type="text" class="form-control" name="username" value="{{ old('username') }}"> </form> 

The {{old ()}} function returns an empty value.
EDIT
I took

 NotFoundHttpException in RouteCollection.php line 145: 
+7
php laravel laravel-5
source share
5 answers

Your problem is that you are not actually sending the username:

 <form role="form" method="POST" action="{{route('signUpPost')}}"> <input type="text" class="form-control" name="username" value="{{ old('username') }}"> </form> 

There is no submit button on the form. If you submit outside the form, then username will not be included.

Add a submit button inside your form - then try again

 <form role="form" method="POST" action="{{route('signUpPost')}}"> <input type="text" class="form-control" name="username" value="{{ old('username') }}"> <input type="submit" value="Submit"> </form> 

Edit - also your controller is wrong. It should be like this:

  return redirect()->route('signUp')->withInput(); 
+18
source share

All you are missing is the flash input for the session. This means that it is available during the next request.

  $request->flash(); 

Do this just before the call to view your form.

Source: http://laravel.com/docs/5.1/requests#old-input

+8
source share

You can try the following: {{ Input::old('username') }} .

+1
source share

I understand that this is not the case in this particular situation, but I also encountered this problem. My problem here was caused by "prefilling data" on the input. Once I removed it, it worked.

Good luck to all!

0
source share
  <div class="form-group @if($errors->first('username')) has-error @endif"> <label for="username" class="rtl">Enter user name </label> <input type="text" name="username" class="form-control rtl basic-usage" id="username" placeholder="Enter user name" value="{!! old('username') !!}"> <span class="help-block required">{{$errors->first('username')}}</span> </div> 

The box above the form will show the entered old value. will show a validation error (you must specify the error separately.) there is a placeholder. bootloader to look better. (add bootloader)

0
source share

All Articles