I am using Laravel 4. I would like to access the current URL inside an @if
condition in a view using the Laravel\'s Blade templating engine but I don\'t know ho
To get current url
in blade
view you can use following,
<a href="{{url()->current()}}">Current Url</a>
So as you can compare using following code,
@if (url()->current() == 'you url')
//stuff you want to perform
@endif
Try this:
@if(collect(explode('/',\Illuminate\Http\Request::capture()->url()))->last() === 'yourURL')
<li class="pull-right"><a class="intermitente"><i class="glyphicon glyphicon-alert"></i></a></li>
@endif
Try this way :
<a href="{{ URL::to('/registration') }}">registration </a>
You should try this:
<b class="{{ Request::is('admin/login') ? 'active' : '' }}">Login Account Details</b>
In Blade file
@if (Request::is('companies'))
Companies name
@endif
You can use this code to get current URL:
echo url()->current();
echo url()->full();
I get this from Laravel documents.