1

How can I determine the path of the page from which the request was made?

I have tried $request->path() or Request::path() but these two return the path on which request is going..

Hassan Saqib
  • 2,597
  • 7
  • 28
  • 51

1 Answers1

8

You may try this:

$request->header('referer');

Also URL::previous will give you that URL, for example:

\URL::previous();

Update: You may use this to send a user back to form on failed validation:

return redirect()->back(); // You may use ->withInput()->withErrors(...) as well
The Alpha
  • 143,660
  • 29
  • 287
  • 307