diff --git a/src/Console/Commands/GenerateApiDocs.php b/src/Console/Commands/GenerateApiDocs.php new file mode 100644 index 0000000..10ee4de --- /dev/null +++ b/src/Console/Commands/GenerateApiDocs.php @@ -0,0 +1,38 @@ +<?php +namespace NexaMerchant\Apis\Console\Commands; +use Illuminate\Support\Facades\Artisan; + +use Nicelizhi\Apps\Console\Commands\CommandInterface; + +class GenerateApiDocs extends CommandInterface + +{ + protected $signature = 'Apis:gendocs'; + + protected $description = 'Generate l5-swagger docs (Admin & Shop).'; + + public function getAppVer() { + return config("Apis.ver"); + } + + public function getAppName() { + return config("Apis.name"); + } + + public function handle() + { + $this->info("Install app: Apis"); + if (!$this->confirm('Do you wish to continue?')) { + // ... + $this->error("App Apis Install cannelled"); + return false; + } + + $this->warn('Step: Generate l5-swagger docs (Admin & Shop)...'); + $result = shell_exec('php artisan l5-swagger:generate --all'); + $this->info($result); + + $this->comment('-----------------------------'); + $this->comment('Success: NexaMerchant REST API has been configured successfully.'); + } +} \ No newline at end of file diff --git a/src/Console/Commands/Install.php b/src/Console/Commands/Install.php index 2cbc097..9995aef 100644 --- a/src/Console/Commands/Install.php +++ b/src/Console/Commands/Install.php @@ -41,6 +41,6 @@ public function handle() $this->info($result); $this->comment('-----------------------------'); - $this->comment('Success: Bagisto REST API has been configured successfully.'); + $this->comment('Success: NexaMerchant REST API has been configured successfully.'); } } \ No newline at end of file diff --git a/src/Providers/ApisServiceProvider.php b/src/Providers/ApisServiceProvider.php index 38bd718..1f29211 100644 --- a/src/Providers/ApisServiceProvider.php +++ b/src/Providers/ApisServiceProvider.php @@ -112,6 +112,7 @@ protected function registerCommands(): void $this->commands([ \NexaMerchant\Apis\Console\Commands\Install::class, \NexaMerchant\Apis\Console\Commands\UnInstall::class, + \NexaMerchant\Apis\Console\Commands\GenerateApiDocs::class, ]); } }