Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel back button

Tags:

php

laravel

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?

like image 801
cosapostolo Avatar asked Sep 08 '12 19:09

cosapostolo


People also ask

How to set back button in laravel?

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.


1 Answers

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

like image 109
Anon Avatar answered Sep 25 '22 06:09

Anon