I tried but failed .....
try again
this is ?:
foreach ($categories as $key => $category) {
$node = $this->makeNode([]);
if ($category['level_depth'] > 3) {
$cat = new Category($category['id_category']);
$link = $cat->getLink();
// Check if customer is set and check access
if (Validate::isLoadedObject($this->context->customer) && !$cat->checkAccess($this->context->customer->id)) {
continue;
}
} else {
$link = $this->context->link->getPageLink('index');
}