Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SergioGregorutti's avatar

[5.2] Get current route name in Blade templates

Hi all,

This seems to be a simple question but I can't figure out how to do it.

I need to know what is the current route name in a Blade template to be able to do something like:

@if ($currentRoute == 'homepage') 
...
@endif

Im using Laravel 5.2 Can someone help me on this?

Thanks in advance!

0 likes
7 replies
zachleigh's avatar

You can use the url() global function:

url()->current()
2 likes
KLM113's avatar

That's not even valid blade syntax

Please or to participate in this conversation.