From 8030b097e714a716eb132d24eeb09f62067c6a18 Mon Sep 17 00:00:00 2001 From: Pranshu Tomar Date: Thu, 23 Apr 2020 13:46:47 +0530 Subject: [PATCH] Moved command to packages --- app/Console/Kernel.php | 42 ------------------- .../src}/Console/Commands/BagistoVersion.php | 2 +- .../Core/src/Console/Commands/Install.php | 4 +- .../src/Providers/CoreServiceProvider.php | 16 +++++++ .../Console/Commands/GenerateProducts.php | 2 +- .../src/Providers/ProductServiceProvider.php | 3 +- 6 files changed, 22 insertions(+), 47 deletions(-) delete mode 100755 app/Console/Kernel.php rename {app => packages/Webkul/Core/src}/Console/Commands/BagistoVersion.php (94%) rename app/Console/Commands/install.php => packages/Webkul/Core/src/Console/Commands/Install.php (98%) rename {app => packages/Webkul/Product/src}/Console/Commands/GenerateProducts.php (98%) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php deleted file mode 100755 index a8c515859..000000000 --- a/app/Console/Kernel.php +++ /dev/null @@ -1,42 +0,0 @@ -command('inspire') - // ->hourly(); - } - - /** - * Register the commands for the application. - * - * @return void - */ - protected function commands() - { - $this->load(__DIR__.'/Commands'); - - require base_path('routes/console.php'); - } -} diff --git a/app/Console/Commands/BagistoVersion.php b/packages/Webkul/Core/src/Console/Commands/BagistoVersion.php similarity index 94% rename from app/Console/Commands/BagistoVersion.php rename to packages/Webkul/Core/src/Console/Commands/BagistoVersion.php index 6e0b5c04f..660d9f420 100644 --- a/app/Console/Commands/BagistoVersion.php +++ b/packages/Webkul/Core/src/Console/Commands/BagistoVersion.php @@ -1,6 +1,6 @@ registerFacades(); + + $this->registerCommands(); } /** @@ -66,6 +70,18 @@ class CoreServiceProvider extends ServiceProvider }); } + /** + * Register the console commands of this package + * + * @return void + */ + protected function registerCommands(): void + { + if ($this->app->runningInConsole()) { + $this->commands([BagistoVersion::class, Install::class,]); + } + } + /** * Register factories. * diff --git a/app/Console/Commands/GenerateProducts.php b/packages/Webkul/Product/src/Console/Commands/GenerateProducts.php similarity index 98% rename from app/Console/Commands/GenerateProducts.php rename to packages/Webkul/Product/src/Console/Commands/GenerateProducts.php index 5a94f7d4b..06d5156d9 100644 --- a/app/Console/Commands/GenerateProducts.php +++ b/packages/Webkul/Product/src/Console/Commands/GenerateProducts.php @@ -1,6 +1,6 @@ app->runningInConsole()) { - $this->commands([PriceUpdate::class,]); + $this->commands([PriceUpdate::class, GenerateProducts::class,]); } }