I try to find name of previous route in Laravel 5.1. With:
{!! URL::previous() !!}
I get the route url, but I try to get route name like I
Here what work for me. I find this answer and this question and modify it to work in my case: https://stackoverflow.com/a/36476224/2807381
@if(app('router')->getRoutes()->match(app('request')->create(URL::previous()))->getName() == 'public.contact')
Some text
@endif
Update for 5.8 version by Robert
app('router')->getRoutes()->match(app('request')->create(url()->previous()))->getName()