When you use the method back()
, it makes use of the class Urlgenerator, to be more specific, the method previous()
:
/**
* Get the URL for the previous request.
*
* @return string
*/
public function previous()
{
$referrer = $this->request->headers->get('referer');
$url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession();
return $url ?: $this->to('/');
}
This method validates and removes the parameters from the url before returning it through the method to()
of that same class.
Taking that into account, if we use the first line of this method, we will receive for example, something like:
http://localhost:8000/user? id=1&name=Rafael
If you combine this with the method redirect()
, you will return to the same previous url, including its parameters. For example:
...
public function index()
{
// the previous url with the old params.
$url = request()->headers->get('referer');
return redirect($url);
}
...
You can include the bootstrap code sff.. At least tabs to see the classes. Is this what you mean? http://jsfiddle.net/xfw8t/12/
– Miguel
Yes, I’d like to return to the corresponding tab
– Igor Sandro
Done on @Igor, I think this is the best for what you want to do
– Miguel