Migrate HickLab3D dashboard and add production auto deployment
Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 19s
Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 19s
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
#[Signature('app:create-admin {username} {email}')]
|
||||
#[Description('Create the first HickLab3D administrator')]
|
||||
class CreateAdmin extends Command
|
||||
{
|
||||
public function handle(): int
|
||||
{
|
||||
$username = (string) $this->argument('username');
|
||||
$email = (string) $this->argument('email');
|
||||
if (User::where('username', $username)->orWhere('email', $email)->exists()) {
|
||||
$this->error('That username or email already exists.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
$password = (string) $this->secret('Password (at least 12 characters)');
|
||||
if (mb_strlen($password) < 12) {
|
||||
$this->error('Password is too short.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
User::create(['username' => $username, 'email' => $email, 'role' => 'admin', 'password' => $password]);
|
||||
$this->info('Administrator created.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user