How to get the current URL inside @if statement (blade) in Laravel 4? -


i using laravel 4. access current url inside @if condition in view using laravel's blade templating engine don't know how it.

i know can done using <?php echourl::current(); ?> it's not possible inside @if blade statement.

any suggestion?

you can use: request::url() obtain current url, here example:

@if(request::url() === 'your url here')     // code @endif 

laravel offers method find out, whether url matches pattern or not

if (request::is('admin/*')) {     // code } 

check related documentation obtain different request information: http://laravel.com/docs/requests#request-information


Comments