Answers for "how to set active route in laravel"

PHP
1

laravel active route check

{{  request()->routeIs('news.*') ? 'active' : '' }}
Posted by: Guest on August-16-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

Browse Popular Code Answers by Language