I'm trying to make a menu active depending on route in laravel 4.1, my attempt:
<li
{{{ (Request::is('/core') ? 'class="active"' : '') }}}><a href="{{{ URL::to('/core') }}}">Control Panel</a>
</li>
My route:
Route::get('/core', 'CoreController@Showindex');
This is not throwing any errors just simply ignored. any help is appreciated.
In Laravel 4.2:
By name:
<li class="{{ Route::is('user') ? 'active' : ''}}">Profile</li>
router.php
Route::get('/user/{id}', ['as' => 'user', 'uses' => 'UserController@profile']);
By url:
<li class="{{ Request::is('user/*') ? 'active' : '' }}">Profile</li>
changed to:
<li
{{{ (Request::is('/core') ? 'class=active' : '') }}}><a href="{{{ URL::to('/core') }}}">Control Panel</a>
</li>
from 'class="active"'
to 'class=active'
This working fine for <li>
tag but not <a>
tag, needs to be used like so:
<a href="{{{ URL::to('core') }}}" class="list-group-item {{{ (Request::is('core') ? 'active' : '') }}}">Overview</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With