Add new console commands for root email change, root password reset, and service deletion

This commit is contained in:
Andras Bacsai 2023-11-22 13:21:25 +01:00
parent ce26127705
commit 5e27b88bef
6 changed files with 50 additions and 9 deletions

View File

@ -0,0 +1,41 @@
<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
class RootChangeEmail extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'root:change-email';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Change Root Email';
/**
* Execute the console command.
*/
public function handle()
{
//
$this->info('You are about to change the root user\'s email.');
$email = $this->ask('Give me a new email for root user');
$this->info('Updating root email...');
try {
User::find(0)->update(['email' => $email]);
$this->info('Root user\'s email updated successfully.');
} catch (\Exception $e) {
$this->error('Failed to update root user\'s email.');
return;
}
}
}

View File

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

View File

@ -12,21 +12,21 @@
use function Laravel\Prompts\multiselect;
use function Laravel\Prompts\select;
class ResourcesDelete extends Command
class ServicesDelete extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'resources:delete';
protected $signature = 'services:delete';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Delete a resource from the database';
protected $description = 'Delete a service from the database';
/**
* Execute the console command.
@ -34,7 +34,7 @@ class ResourcesDelete extends Command
public function handle()
{
$resource = select(
'What resource do you want to delete?',
'What service do you want to delete?',
['Application', 'Database', 'Service', 'Server'],
);
if ($resource === 'Application') {

View File

@ -7,7 +7,7 @@
// The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.145',
'release' => '4.0.0-beta.146',
// When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php
return '4.0.0-beta.145';
return '4.0.0-beta.146';

View File

@ -4,7 +4,7 @@
"version": "3.12.36"
},
"v4": {
"version": "4.0.0-beta.145"
"version": "4.0.0-beta.146"
}
}
}