fix active menu
This commit is contained in:
@ -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[]
|
||||
*/
|
||||
|
Reference in New Issue
Block a user