1
0
mirror of https://github.com/Kovah/LinkAce.git synced 2025-04-21 23:42:10 +02:00

Optimize the setup:complete and registeruser commands

This commit is contained in:
Kevin Woblick 2025-03-17 21:37:26 +01:00
parent 0766fff8ee
commit b04115bf3b
2 changed files with 10 additions and 3 deletions

View File

@ -24,7 +24,7 @@ class CompleteSetupCommand extends Command
return;
}
$this->info('Successfully marked the setup as completed. You can now visit the web interface.');
$this->line('Hint: If you install LinkAce with PostgreSQL or SQLite, use the <options=reverse>registeruser</> command now.');
$this->info('Successfully marked the setup as completed.');
$this->info('Use the <options=reverse> php artisan registeruser --admin </> command now to create your first admin user.');
}
}

View File

@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Actions\Fortify\CreateNewUser;
use App\Enums\Role;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Validation\ValidationException;
@ -19,6 +20,11 @@ class RegisterUserCommand extends Command
public function handle(): void
{
if ($this->option('admin') === false && User::query()->count() <= 1) {
$this->warn('It seems you are creating the first user. This user should be an admin!');
$this->warn('Please consider running the command with --admin again.');
}
$this->userName = $this->argument('name');
$this->userEmail = $this->argument('email');
@ -52,7 +58,8 @@ class RegisterUserCommand extends Command
protected function askForUserDetails(): void
{
if (empty($this->userName) || $this->validationFailed) {
$this->userName = $this->ask('Please enter the user name containing only alpha-numeric characters, dashes or underscores', $this->userName);
$this->userName = $this->ask('Please enter the user name containing only alpha-numeric characters, dashes or underscores',
$this->userName);
}
if (empty($this->userEmail) || $this->validationFailed) {