Skip to content

Commit

Permalink
add gendocs command
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Jun 20, 2024
1 parent 95f7115 commit 661117c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
38 changes: 38 additions & 0 deletions src/Console/Commands/GenerateApiDocs.php
Original file line number Diff line number Diff line change
@@ -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.');
}
}
2 changes: 1 addition & 1 deletion src/Console/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}
1 change: 1 addition & 0 deletions src/Providers/ApisServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}
}
Expand Down

0 comments on commit 661117c

Please sign in to comment.