How to return back twice in Laravel?
No, but you could use session system to save URLs of 2-3-4 pages back. Use Session::
facade or session()
helper for shorter syntax:
$links = session()->has('links') ? session('links') : [];
$currentLink = request()->path(); // Getting current URI like 'category/books/'
array_unshift($links, $currentLink); // Putting it in the beginning of links array
session(['links' => $links]); // Saving links array to the session
And to use it:
return redirect(session('links')[2]); // Will redirect 2 links back