I am also facing the exact same problem and google is not helping out :-(
return Redirect::intended('/');
always goes to to the getController however it should go to postController in my case.
@Sloothword Did you got any resolution for this problem?
I have the very same problem
Imo, ideally the built in "intended" method should conserve the post data and re-post this on successful login. If that's not possible, I would prefer it going to the supplied argument (i e "/") rather than doing a GET to the intended URL.
Any of you figured out a solution to this yet?
Laravel's Redirect uses the HTTP response redirect method. There is no redirect method with POST in HTTP hence it doesn't exist in Laravel.
You can build a method to capture the post data and then POST it after a user logs in, but you will have to do it with CURL, or something similar, you can't use an HTTP response code to redirect and POST, redirect is by nature a GET request.
Well in the end i used something similar to Workaround 3: My route filter persists not only the intended route but also the POST data. After redirect i get redirected (via GET) to the controller action, check for saved POST data and use this.
As i only needed that functionality in two special cases it was not worth it to implement some generic system. But i could swear i saw some tutorial online for extending the Laravel redirect/request system to also handle POST. Unfortunately i could not find it again.
@IanSirKit Yes, HTTP redirect only supports GET, but you could also just call the POST request without redirecting the browser via something like
$request = Request::create('api/items', 'POST', $params);
return Route::dispatch($request)->getContent();
I had this same desire to redirect back for POST requests. I wrote up here on stackoverflow how I did it.
I am now working on adapting it for Laravel 5 as the same approach doesn't seem to be working.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community