I am trying to create a simple back button on a page. The user can arrive to this page from two different pages so I would like to know from which page he arrived. Is that possible?
You can use {{ URL::previous() }} But it not perfect UX. For example, when you press F5 button and click again to Back Button with {{ URL::previous() }} you will stay in. A good way is using {{ route('page.
In Laravel, you can do something like this: <a href="{{ Request::referrer() }}">Back</a>
(assuming you're using Blade).
Laravel 4
{{ URL::previous() }}
Laravel 5+
{{ url()->previous() }}
Laravel documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With