laravelista / Ekko

Framework agnostic PHP package for marking navigation items active.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ekko::areActiveMatch and helper

Turboveja opened this issue · comments

if (!function_exists('are_active_match')) {
    /**
     * Detects if the given string array is found in the current URL.
     *
     * @param array  $matches
     * @param string $output
     *
     * @return string
     */
    function are_active_match($matches, $output = "active")
    {
        foreach($matches as $match){
            if(isActiveMatch($match)){
                return $output;
            }
        }

        return null;
    }
}

I can see this being useful. Can you do a PR?