From 0ace8c9cb6b924ac11d7738112b89ad779e7e842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Sun, 2 Oct 2016 14:31:24 +0200 Subject: [PATCH] FIX: fix template installation --- app/Console/Commands/SetTemplate.php | 17 ++++++----------- app/Models/Module.php | 1 + 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/app/Console/Commands/SetTemplate.php b/app/Console/Commands/SetTemplate.php index 22901daa..462d5127 100644 --- a/app/Console/Commands/SetTemplate.php +++ b/app/Console/Commands/SetTemplate.php @@ -44,10 +44,10 @@ class SetTemplate extends Command if ($current) { $info = json_decode($current->module_settings); - $this->line('Template is already installed. Currently using template ' . trans($current->name) . ' located in /templates/' . $info->staticName.'.'); - $confirm = $this->ask('Uninstall it and install *' . trans($config['name']) . '*? All data associated with installed template will be lost! [y/n]'); + $this->line('Template is already installed. Currently using template ' . trans($current->name) . ' located in /templates/' . $info->staticName . '.'); + $confirm = $this->confirm('Uninstall it and install *' . trans($config['name']) . '*? All data associated with installed template will be lost!'); - if ($confirm === 'y') { + if ($confirm) { $this->line('Uninstalling ' . $current->name . '.'); $current->uninstall(); } else { @@ -66,13 +66,8 @@ class SetTemplate extends Command // theme written $this->line('Template successfully set up.'); - if ($publish) { - $this->line(''); - $this->line(' ** PUBLISHING ASSETS AND VIEWS **'); - // publish assets and views for module and theme - $this->call('vendor:publish'); - $this->call('vendor:publish', ['--tag' => ['public-assets'], '--force' => true]); - $this->call('vendor:publish', ['--tag' => ['module-views'], '--force' => true]); - } + // run again artisan for publishing resources + // it cannot be done using $this->call, because we need to load different template into service providers + exec('php artisan vendor:publish'); } } diff --git a/app/Models/Module.php b/app/Models/Module.php index 82cd681e..bcf9d696 100644 --- a/app/Models/Module.php +++ b/app/Models/Module.php @@ -93,6 +93,7 @@ class Module extends Model // delete everything in /resources/views/visitor if ($this->is_template) { $this->deleteDirectory(resource_path('views/visitor')); + $this->deleteDirectory(resource_path('views/modules')); $this->deleteDirectory(public_path('assets')); // delete all template paths