Skip to content

Instantly share code, notes, and snippets.

@mdestafadilah
Last active December 5, 2017 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdestafadilah/ead3972336c6a87739aec60a80b7ff6b to your computer and use it in GitHub Desktop.
Save mdestafadilah/ead3972336c6a87739aec60a80b7ff6b to your computer and use it in GitHub Desktop.
Check Menu Is Active
/**
* Checks if a given route is active, if so return a class.
*
* This helper lets you easily add classes to active navigation elements using {{ chkNav('posts', 'active') }}
*
* @var string $route
* @var string class
* @return class
*/
function chkNav($route = "", $class = "active") {
if(\Request::is($page.'/*')) {
return $class;
}
return "";
}
#source: http://laravel-tricks.com/tricks/navigation-helper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment