addHeaderMenu(); $this->updateProfileMenu(); //$this->updateEnv(); $this->updateComposer(); } public static function addHeaderMenu() { $path = resource_path('views/backEnd/partials/_menu.blade.php'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (!preg_match("/@include\('chat::components\._menu'\)/", $content)) { $matches = null; preg_match('/
  • /', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('Chat')) @include('chat::components._menu') @endif ".$code; $code = $snippet; $content = preg_replace('/
  • /', $code, $content); //file_put_contents($path, $content); $update = true; } } if ($update) { file_put_contents($path, $content); } } } public function updateProfileMenu() { /*$theme = app('theme'); if ($theme) { $theme_name = app('theme')->folder_path;*/ $path = resource_path('views/frontend/amazy/pages/profile/partials/_menu.blade.php'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (!preg_match("/@include\('chat::components\._dashboard_menu'\)/", $content)) { $matches = null; preg_match('//', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = " @if (isModuleActive('Chat')) @include('chat::components._dashboard_menu') @endif "; $code = $code.$snippet; $content = preg_replace('//', $code, $content); //file_put_contents($path, $content); $update = true; } if ($update) { file_put_contents($path, $content); } } } //} } public function updateEnv() { $path = base_path('.env'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (!preg_match("/BROADCAST_DRIVER=pusher/", $content)) { $matches = null; preg_match('/BROADCAST_DRIVER[.\S]+/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = "BROADCAST_DRIVER=pusher"; $code = $snippet; $content = preg_replace('/BROADCAST_DRIVER[.\S]+/', $code, $content); //file_put_contents($path, $content); $update = true; } if ($update) { file_put_contents($path, $content); } } } } public function updateComposer() { $path = base_path('composer.json'); if (file_exists($path)) { $update = false; $content = file_get_contents($path); if (preg_match("/\"gliterd\/laravel-backblaze-b2\":[.\s\S]+?,/", $content)) { $matches = null; preg_match('/\"gliterd\/laravel-backblaze-b2\":[.\s\S]+?,/', $content, $matches); if (count($matches) > 0) { $code = $matches[0]; $snippet = ""; $code = $snippet; $content = preg_replace('/\"gliterd\/laravel-backblaze-b2\":[.\s\S]+?,/', $code, $content); //file_put_contents($path, $content); $update = true; } if ($update) { file_put_contents($path, $content); } } } } }