hideLegacyPageBuilderMenu(); } public static function hideLegacyPageBuilderMenu() { $theme = app('theme'); if ($theme) { $theme_name = app('theme')->folder_path; $path = resource_path('views/backEnd/partials/_sidebar.blade.php'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (!preg_match("/page_builder/", $content)) { $matches = null; preg_match('/@elseif\(permissionCheck\(@\$menu->backendMenu->route\)\)/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @elseif (@\$menu->backendMenu->route == 'page_builder') @continue ".$code; $code = $snippet; $content = preg_replace('/@elseif\(permissionCheck\(@\$menu->backendMenu->route\)\)/', $code, $content); //file_put_contents($path, $content); $update = true; } } if ($update) { file_put_contents($path, $content); } } } } }