laravel assign active based on route name
<li class="{{ Request::is('products*') ? 'active' : '' }}">
<a href="{{ route('products.index') }}"><span>Products</span></a>
</li>
laravel assign active based on route name
<li class="{{ Request::is('products*') ? 'active' : '' }}">
<a href="{{ route('products.index') }}"><span>Products</span></a>
</li>
laravel assign active based on route name
<li class = "{{ set_active('admin/users') }}">
<a href="{{ url('/admin/users/') }}">Users</a>
</li>
laravel assign active based on route name
function set_active( $route ) {
if( is_array( $route ) ){
return in_array(Request::path(), $route) ? 'active' : '';
}
return Request::path() == $route ? 'active' : '';
}
add active class depending on the route laravel
class="{{ Request::is('products.index') ? 'active' : '' }}"
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us