fix active menu

This commit is contained in:
2024-09-04 16:47:05 +03:00
parent 68bf73e764
commit 9f132e7bc4
3 changed files with 52 additions and 27 deletions

View File

@ -37,30 +37,6 @@ class Menu extends Model
];
}
public static function getChild(int $id)
{
$collection = Menu::where("parent_id", $id)->get();
if (!$collection->isEmpty()){
return $collection;
}
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[]
*/