Support the ongoing development of Laravel.io →
Authentication Requests
Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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();
Last updated 2 years ago.
0

I had this same desire to redirect back for POST requests. I wrote up here on stackoverflow how I did it.

http://stackoverflow.com/questions/18900193/auth-filter-redirecting-back-to-original-post-request-in-laravel/20712245#20712245

I am now working on adapting it for Laravel 5 as the same approach doesn't seem to be working.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Sloothword sloothword Joined 22 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.