diff --git a/src/Commands/FortifyUITablerUpdateCommand.php b/src/Commands/FortifyUITablerUpdateCommand.php new file mode 100644 index 0000000..f45690b --- /dev/null +++ b/src/Commands/FortifyUITablerUpdateCommand.php @@ -0,0 +1,46 @@ +confirm('Do you wish to continue? This updater will try to overwrite existing views, resources, language files and routes.', true)) { + // install fortifyUI + \Artisan::call('fortify-ui:install'); + $this->info('FortifyUI has been updated. Proceeding to update Tabler.io.'); + + // publish the assets, routes, controllers, etc. + $this->publishAssets(); + + // create symbolic link + \Artisan::call('storage:link'); + + // Clear the Route cache + \Artisan::call('route:clear'); + \Artisan::call('route:cache'); + + // print success message + $this->info('The Tabler.io Framework is now updated.'); + $this->newLine(); + $this->line('Please run php artisan migrate before continuing.'); + } else { + // print abort message + $this->error('Update is aborted'); + } + } + + protected function publishAssets() + { + $this->callSilent('vendor:publish', ['--tag' => 'fortify-ui-tabler-resources', '--force' => true]); + } +} diff --git a/src/FortifyUITablerServiceProvider.php b/src/FortifyUITablerServiceProvider.php index da6c077..b005da4 100644 --- a/src/FortifyUITablerServiceProvider.php +++ b/src/FortifyUITablerServiceProvider.php @@ -4,6 +4,8 @@ use Illuminate\Support\ServiceProvider; use Proxeuse\FortifyUITabler\Commands\FortifyUITablerCommand; +use Proxeuse\FortifyUITabler\Commands\FortifyUITablerUpdateCommand; + class FortifyUITablerServiceProvider extends ServiceProvider { @@ -25,6 +27,7 @@ public function boot() $this->commands([ FortifyUITablerCommand::class, + FortifyUITablerUpdateCommand::class, ]); } }