Answers for "add active class depending on the route laravel"

0

laravel assign active based on route name

<li class="{{ Request::is('products*') ? 'active' : '' }}">

    <a href="{{ route('products.index') }}"><span>Products</span></a>

</li>
Posted by: Guest on December-23-2020
0

laravel assign active based on route name

<li class = "{{ set_active('admin/users') }}">
    <a href="{{ url('/admin/users/') }}">Users</a>
</li>
Posted by: Guest on December-23-2020
0

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' : '';
}
Posted by: Guest on December-23-2020
0

add active class depending on the route laravel

class="{{ Request::is('products.index') ? 'active' : '' }}"
Posted by: Guest on June-01-2021

Code answers related to "add active class depending on the route laravel"

Browse Popular Code Answers by Language