redirect to previous page on laravel

- 1 answer


I need to redirect to the previous page once an item is edited but it's redirecting to the same page (edit) again.

I've tried with Redirect::back() and URL:previous(). This is the flow:

  1. (init from one of this two pages) show_pageA or show_pageB
  2. ->(user clicks edit button) [email protected]
  3. ->(clicks save) [email protected]
  4. ->(store method ends redirecting back) [email protected]

Instead of being redirected at the steep 4 to [email protected] I'd like to be redirected to 1. No mather if the page was show_pageA or show_pageB (so I can't do any redirect to specific_page). How can I accomplish this task?




That is the same issue as with redirecting user after a Login - a lot of developers want to redirect to the page from where the user came to login page.

So, what you have to do, is to store the page in the session when you open the GET 'edit' URL and then use it to redirect the user.