php - Redirect route with input -


consider scenario, have following pair of routes:

route::post('cart/update', ['uses' => 'cartcontroller@update', 'as' => 'cart.update']); route::match(['get', 'post'], 'order/checkout', ['uses' => 'ordercontroller@checkout', 'as' => 'order.checkout']); 

in cart.update route, if this:

return redirect::route('order.checkout')->withinput(); 

and use dd(input::all()) @ order.checkout, receive empty array.

however, instead if use dd(input::old()), receive array input values expecting.

is supposed behave that?

shouldn't receive input::all() @ order.checkout route?

from laravel docs: http://laravel.com/docs/4.2/requests#old-input

you may need keep input 1 request until next request. example, may need re-populate form after checking validation errors.

since want flash input in association redirect previous page, may chain input flashing onto redirect.

so yes, behavior correct. you're supposed use input::old() potentially repopulate forms may have not passed validation, example.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -