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

Amidamaru's avatar

How to check if i am on current route or url?

I am trying to restrict a certain content in Laravel.

Problem: I want to hide the navigation if it is on Login page. Inside the conditional statement is a menu that is wrapped using the nav tag.

This is the current code that I use but it is not working..

@if (!Request::url() === 'login')
    <nav></nav>
@endif

Any help is appreciated.

0 likes
6 replies
Amidamaru's avatar

@tomo_pongrac i'm still a bit confuse how to convert the documentation example into a working example.

can you please write the conditional code for me? thanks

Mibiansmovement's avatar

Six years after and I appear to offer my own snippet which might help someone else

@if(!Route::is('login')) your_code_here @endif

1 like

Please or to participate in this conversation.