Navigation Helper

Submitted by alexmayo - 7 years 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 "";
}