active menu

This commit is contained in:
2024-09-04 14:35:29 +03:00
parent 1f34860cfd
commit 68bf73e764
4 changed files with 37 additions and 15 deletions

View File

@ -47,6 +47,20 @@ class Menu extends Model
return false;
}
public static function hasActiveChild(int $id): bool
{
$child = self::getChild($id);
if (!$child->isEmpty()){
foreach ($child as $item){
if ($item->url === \kernel\Request::getUrlPath()){
return true;
}
}
}
return false;
}
/**
* @return string[]
*/