Stelle das U0-Fundament mit CMS, Mitgliedern und Filament bereit.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
89b35ac480
commit
2035c46edd
130 files changed
+18519
-50
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Domain\Identity\AssignStaffRoles;
|
||||
use App\Domain\Identity\RegisterAccount;
|
||||
use App\Domain\Identity\StaffRole;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CreateStaffUser extends Command
|
||||
{
|
||||
protected $signature = 'luf:personal {email} {--role=systemverwalter} {--name=Personal}';
|
||||
|
||||
protected $description = 'Legt ein bestätigtes Personalkonto an und gibt das Passwort einmal aus';
|
||||
|
||||
public function handle(RegisterAccount $register, AssignStaffRoles $assign): int
|
||||
{
|
||||
$role = StaffRole::tryFrom((string) $this->option('role'));
|
||||
|
||||
if ($role === null) {
|
||||
$this->error('Unbekannte Rolle.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$password = Str::password(20);
|
||||
$user = $register->register((string) $this->option('name'), (string) $this->argument('email'), $password, true);
|
||||
$user->markEmailAsVerified();
|
||||
$assign->sync($user, [$role->value], $user);
|
||||
|
||||
$this->info('Konto angelegt. Passwort (nur diese Ausgabe):');
|
||||
$this->line($password);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user