Skip to content

Instantly share code, notes, and snippets.

@aindong
Created February 25, 2017 00:06
Show Gist options
  • Save aindong/4f7bce99e4471003cc7d1161970775fc to your computer and use it in GitHub Desktop.
Save aindong/4f7bce99e4471003cc7d1161970775fc to your computer and use it in GitHub Desktop.
make current nagivation link active
//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