0

Sorry, i'm novice with laravel.

Is there a way to know, in laravel, which view a request comes from?

For example I have a page called "first.blade.php" and a call "second.blade.php". Both have a link to the third.blade.php page.

In third.blade.php, I wish I could do such a thing:

if ($come_from == "first") {
  // do somenthing
}
elseif ($come_from == "second") {
  // do something else
}
Vardar
  • 1
  • 3
  • See this [answer](https://stackoverflow.com/questions/24040886/laravel-get-the-name-of-the-view-that-called-the-controller-method) it might help – Makdous May 08 '20 at 15:36
  • It would be easier to do your logic in the controller. and if you are using names routes, you can check this solution here: https://stackoverflow.com/a/40690241/4258328 – Christophe Hubert May 08 '20 at 16:06

1 Answers1

0

You can try to use route to recognize the previous request like so

url()->previous()

Kurt Chun
  • 391
  • 4
  • 9