Laravel back button

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


I know this is an oldish question but I found it whilst looking for the same solution. The solution above doesn't appear to work in Laravel 4, you can however use this now:

<a href="{{ URL::previous() }}">Go Back</a>

Hope this helps people who look for this feature in L4

(Source: https://github.com/laravel/framework/pull/501/commits)


Laravel 5.2+, back button

<a href="{{ url()->previous() }}" class="btn btn-default">Back</a>

Tags:

Php

Laravel