src/app/http/middleware/HCACLAdminMenu.php
private function buildMenuWithoutExistingParent($menuAccessible)
    {
        $withoutParent = collect($this->itemsWithoutParent)->unique('route')->all();

        foreach ( $withoutParent as &$item ) {
            $children = $this->buildMenuTree($menuAccessible, $item['route']);

            if( $children ) {
                $item['children'] = $children;
            }
        }

        return $withoutParent;
    }
private function buildMenuWithoutExistingParent($menuAccessible)
    {
        $withoutParent = collect($this->itemsWithoutParent)->unique('route')->all();

        foreach ( $withoutParent as &$item ) {
            $children = $this->buildMenuTree($menuAccessible, $item['route']);

            if( $children ) {
                $item['children'] = $children;
            }
        }

        return $withoutParent;
    }
private function buildMenuWithoutExistingParent ( $ menuAccessible ) { $ withoutParent = collect ( $ this -> itemsWithoutParent ) -> unique ( 'route' ) -> all ( ) ; foreach ( $ withoutParent as & $ item ) { $ children = $ this -> buildMenuTree ( $ menuAccessible , $ item [ 'route' ] ) ; if ( $ children ) { $ item [ 'children' ] = $ children ; } } return $ withoutParent ; }
Add child menu items to their parents. Only two levels

@param $menuAccessible
@return array
Add child menu items to their parents . Only two levels