addToggleToMainMenu(); $this->addToggleToMenu(); } public function addToggleToMainMenu() { $path = resource_path('views/frontend/amazy/partials/_mainmenu.blade.php'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (!preg_match("/\@include\('theme::toggle'\)/", $content)) { $matches = null; preg_match('/
<\/div>/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('Theme')) @include('theme::toggle') @endif "; $code = $snippet.$code; $content = preg_replace('/
<\/div>/', $code, $content); //file_put_contents($path, $content); $update = true; } } if ($update) { file_put_contents($path, $content); } } } public function addToggleToMenu() { $path = resource_path('/views/backEnd/partials/_menu.blade.php'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (!preg_match("/\@include\('theme::toggle'\)/", $content)) { $matches = null; preg_match("/
/", $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('Theme')) @include('theme::toggle') @endif "; $code = $code.$snippet; $content = preg_replace("/
/", $code, $content); $update = true; } } if ($update) { file_put_contents($path, $content); } } } }