Redirect to different pages based on previous page in Laravel
问题 Imagine you have a method in controller, like storing a new company. Also imagine we can create new company from different pages in our site. For example, I can create a company from 2-3 pages. Depending on where I created the company I need to have different redirects. Sometimes I need to redirect back, and sometimes to other routes. Something like: if ($previousRoute === 'companies.index') { return redirect()->back(); } else { return redirect()->route('someroute'); } I guess I can't get the