0

How to go back in two step in la ravel?

 return \Redirect::back();

i have tried to back 2 step but i don't want to use store URL in local storage .

Eddie
  • 26,593
  • 6
  • 36
  • 58
Mukund Bharti
  • 251
  • 4
  • 19
  • https://stackoverflow.com/questions/36098589/how-to-return-back-twice-in-laravel – Sohel0415 May 06 '19 at 09:32
  • 5
    Possible duplicate of [How to return back twice in Laravel?](https://stackoverflow.com/questions/36098589/how-to-return-back-twice-in-laravel) – Sohel0415 May 06 '19 at 09:32

1 Answers1

0

You can use SESSION to store pages and redirect two times.

first of all we get current url like 'localhost.com/test/friend/' after that we put it into array. after that you can use return redirect(session('links')[2]); to return twice.

$url = session()->has('url') ? session('url') : [];
$page = request()->path(); 
array_unshift($url, $page); 
session(['url' => $url]);

2

another solution is to use store each url.(not recommended)

session(['some_url' => request()->path()]);
Mohsen Shakibafar
  • 254
  • 1
  • 2
  • 15