1

Searching on the web i found that the URI class in laravel 4 was moved to Request::path();

I looked hard on laravel docs, but i didn't find what i was looking for.

So how to get the uri from the page we are coming from in laravel 4 if URI::previous() is no more possible?

pietrovismara
  • 6,102
  • 5
  • 33
  • 45
  • `Request::server('HTTP_REFERER')` helped me: https://stackoverflow.com/a/45713501/470749 – Ryan Oct 17 '17 at 22:44

1 Answers1

4

In Laravel 4 URL::previous() does the magic. The method just looks up the HTTP referer from $_SERVER['HTTP_REFERER'].

But heads up, be aware that (from the php manual):

The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

passioncoder
  • 909
  • 6
  • 10
  • You're right, for some strange reason URL::previous() didn't work and i ended up using http_referer, but now previous() work too! – pietrovismara Sep 05 '14 at 19:10