Navigation Helper

Submitted by alexmayo - 2 weeks ago

This helper lets you easily add classes to active navigation elements using {{ chkNav('posts', 'active') }}

/**
 * Checks if a given route is active, if so return a class.
 *
 * @var string  $route
 * @var string  class
 * @return class
 */
function chkNav($route = "", $class = "active") {
    if(\Request::is($page.'/*')) {
        return $class;
    }
    return "";
}

Ads cover the costs of maintaining Laravel-tricks

comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks