argument('theme_name'); if (!is_dir(resource_path('views/visitor/' . $theme))) { throw new NotFoundHttpException('Invalid theme ' . $theme . '!'); } $env = file_get_contents(base_path('.env')); $env = preg_replace('/THEME=(.+)/i', 'THEME=' . $theme, $env); if (!Str::contains($env, 'THEME')) { $env = sprintf("%s\nTHEME=%s\n", $env, $theme); } file_put_contents(base_path('.env'), $env); $this->line('Theme successfully setup.'); } }