Created
February 25, 2017 00:06
-
-
Save aindong/4f7bce99e4471003cc7d1161970775fc to your computer and use it in GitHub Desktop.
make current nagivation link active
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//throw this in your helper.php | |
function set_active($path, $active = 'active') { | |
return call_user_func_array('Request::is', (array)$path) ? $active : ''; | |
} | |
// use it like so | |
<a class="{{ set_active(['admin/institutes*','admin/courses*']) }}">Learning</a> | |
// you can pass a single string to a route or multiple and wildcards |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment