update commands

This commit is contained in:
Andras Bacsai 2023-10-03 12:08:57 +02:00
parent 75862ca8de
commit 194675c838
2 changed files with 16 additions and 4 deletions

View File

@ -10,14 +10,14 @@ use Illuminate\Console\Command;
use function Laravel\Prompts\confirm; use function Laravel\Prompts\confirm;
use function Laravel\Prompts\select; use function Laravel\Prompts\select;
class ResourceDelete extends Command class ResourcesDelete extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
* @var string * @var string
*/ */
protected $signature = 'resource:delete'; protected $signature = 'resources:delete';
/** /**
* The console command description. * The console command description.
@ -46,6 +46,10 @@ class ResourceDelete extends Command
private function deleteApplication() private function deleteApplication()
{ {
$applications = Application::all(); $applications = Application::all();
if ($applications->count() === 0) {
$this->error('There are no applications to delete.');
return;
}
$application = select( $application = select(
'What application do you want to delete?', 'What application do you want to delete?',
$applications->pluck('name')->toArray(), $applications->pluck('name')->toArray(),
@ -60,6 +64,10 @@ class ResourceDelete extends Command
private function deleteDatabase() private function deleteDatabase()
{ {
$databases = StandalonePostgresql::all(); $databases = StandalonePostgresql::all();
if ($databases->count() === 0) {
$this->error('There are no databases to delete.');
return;
}
$database = select( $database = select(
'What database do you want to delete?', 'What database do you want to delete?',
$databases->pluck('name')->toArray(), $databases->pluck('name')->toArray(),
@ -74,6 +82,10 @@ class ResourceDelete extends Command
private function deleteService() private function deleteService()
{ {
$services = Service::all(); $services = Service::all();
if ($services->count() === 0) {
$this->error('There are no services to delete.');
return;
}
$service = select( $service = select(
'What service do you want to delete?', 'What service do you want to delete?',
$services->pluck('name')->toArray(), $services->pluck('name')->toArray(),

View File

@ -8,14 +8,14 @@ use Illuminate\Support\Facades\Hash;
use function Laravel\Prompts\password; use function Laravel\Prompts\password;
class ResetRootPassword extends Command class UsersResetRoot extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
* @var string * @var string
*/ */
protected $signature = 'app:reset-root-password'; protected $signature = 'users:reset-root';
/** /**
* The console command description. * The console command description.