Skip to content

Instantly share code, notes, and snippets.

@ahmedsayedabdelsalam
Created May 8, 2019 21:05
Show Gist options
  • Select an option

  • Save ahmedsayedabdelsalam/eb626b138b63ab7ab51fe64bef312ab2 to your computer and use it in GitHub Desktop.

Select an option

Save ahmedsayedabdelsalam/eb626b138b63ab7ab51fe64bef312ab2 to your computer and use it in GitHub Desktop.
<?php
if (!function_exists('classActivePath')) {
function classActivePath($segment, $value)
{
if(!is_array($value)) {
return Request::segment($segment) == $value ? ' menu-open' : '';
}
foreach ($value as $v) {
if(Request::segment($segment) == $v) return ' menu-open';
}
return '';
}
}
if (!function_exists('classActiveSegment')) {
function classActiveSegment($segment, $value)
{
if(!is_array($value)) {
return Request::segment($segment) == $value ? 'active' : '';
}
foreach ($value as $v) {
if(Request::segment($segment) == $v) return 'active';
}
return '';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment