芝麻web文件管理V1.00
编辑当前文件:/home/c7lekhnath/silverray.com.au/Modules/CustomMenu/app/Helpers/helper.php
getId(); // Retrieve the unique session ID $mainMenuKey = 'mainMenuGetBySlug_' . $sessionId; return Cache::rememberForever($mainMenuKey, function () use ($slug) { return menuGetBySlug($slug); }); } } if ( !function_exists( 'footerMenuGetBySlug' ) ) { function footerMenuGetBySlug( $slug ) { $sessionId = session()->getId(); // Retrieve the unique session ID $footerMenuKey = 'footerMenuGetBySlug_' . $sessionId; return Cache::rememberForever( $footerMenuKey, function () use ( $slug ) { return menuGetBySlug( $slug ); } ); } } if ( !function_exists( 'footerBottomMenuGetBySlug' ) ) { function footerBottomMenuGetBySlug( $slug ) { $sessionId = session()->getId(); // Retrieve the unique session ID $footerBottomMenuKey = 'footerBottomMenuGetBySlug_' . $sessionId; return Cache::rememberForever( $footerBottomMenuKey, function () use ( $slug ) { return menuGetBySlug( $slug ); } ); } } if ( !function_exists( 'menuGetBySlug' ) ) { function menuGetBySlug( $slug ) { $menu = Menu::bySlug( $slug ); return is_null( $menu ) ? [] : menuGetById( $menu->id ); } } if ( !function_exists( 'menuGetById' ) ) { function menuGetById( $menu_id ) { $menuItem = new MenuItem; $menu_list = $menuItem->getAll( $menu_id ); $roots = $menu_list->where( 'menu_id', (integer) $menu_id )->where( 'parent_id', 0 ); $items = menuTree( $roots, $menu_list ); return $items; } } if ( !function_exists( 'menuTree' ) ) { function menuTree( $items, $all_items ) { $data_arr = array(); $i = 0; foreach ( $items as $item ) { $data_arr[$i] = $item->toArray(); $find = $all_items->where( 'parent_id', $item->id ); $data_arr[$i]['child'] = array(); if ( $find->count() ) { $data_arr[$i]['child'] = menuTree( $find, $all_items ); } $i++; } return $data_arr; } }