From 194675c838f5baf5ab5ba4d2281fe56084ac5cb4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 3 Oct 2023 12:08:57 +0200 Subject: [PATCH] update commands --- .../{ResourceDelete.php => ResourcesDelete.php} | 16 ++++++++++++++-- ...{ResetRootPassword.php => UsersResetRoot.php} | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) rename app/Console/Commands/{ResourceDelete.php => ResourcesDelete.php} (83%) rename app/Console/Commands/{ResetRootPassword.php => UsersResetRoot.php} (92%) diff --git a/app/Console/Commands/ResourceDelete.php b/app/Console/Commands/ResourcesDelete.php similarity index 83% rename from app/Console/Commands/ResourceDelete.php rename to app/Console/Commands/ResourcesDelete.php index d0c18f5cc..d230aa927 100644 --- a/app/Console/Commands/ResourceDelete.php +++ b/app/Console/Commands/ResourcesDelete.php @@ -10,14 +10,14 @@ use Illuminate\Console\Command; use function Laravel\Prompts\confirm; use function Laravel\Prompts\select; -class ResourceDelete extends Command +class ResourcesDelete extends Command { /** * The name and signature of the console command. * * @var string */ - protected $signature = 'resource:delete'; + protected $signature = 'resources:delete'; /** * The console command description. @@ -46,6 +46,10 @@ class ResourceDelete extends Command private function deleteApplication() { $applications = Application::all(); + if ($applications->count() === 0) { + $this->error('There are no applications to delete.'); + return; + } $application = select( 'What application do you want to delete?', $applications->pluck('name')->toArray(), @@ -60,6 +64,10 @@ class ResourceDelete extends Command private function deleteDatabase() { $databases = StandalonePostgresql::all(); + if ($databases->count() === 0) { + $this->error('There are no databases to delete.'); + return; + } $database = select( 'What database do you want to delete?', $databases->pluck('name')->toArray(), @@ -74,6 +82,10 @@ class ResourceDelete extends Command private function deleteService() { $services = Service::all(); + if ($services->count() === 0) { + $this->error('There are no services to delete.'); + return; + } $service = select( 'What service do you want to delete?', $services->pluck('name')->toArray(), diff --git a/app/Console/Commands/ResetRootPassword.php b/app/Console/Commands/UsersResetRoot.php similarity index 92% rename from app/Console/Commands/ResetRootPassword.php rename to app/Console/Commands/UsersResetRoot.php index 61e0eb309..d72ef07d9 100644 --- a/app/Console/Commands/ResetRootPassword.php +++ b/app/Console/Commands/UsersResetRoot.php @@ -8,14 +8,14 @@ use Illuminate\Support\Facades\Hash; use function Laravel\Prompts\password; -class ResetRootPassword extends Command +class UsersResetRoot extends Command { /** * The name and signature of the console command. * * @var string */ - protected $signature = 'app:reset-root-password'; + protected $signature = 'users:reset-root'; /** * The console command description.