Seebad 0.3 stays in this release. With a single landlord every host still reaches the default website. Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
966 B
PHP
35 lines
966 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Console\Attributes\Description;
|
|
use Illuminate\Console\Attributes\Signature;
|
|
use Illuminate\Console\Command;
|
|
|
|
#[Signature('users:promote-operator {email : E-Mail-Adresse}')]
|
|
#[Description('Grant the operator flag. The account keeps its password, two-factor setup and any landlord role.')]
|
|
class PromoteOperator extends Command
|
|
{
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle(): int
|
|
{
|
|
$email = mb_strtolower(trim((string) $this->argument('email')));
|
|
$user = User::query()->where('email', $email)->first();
|
|
|
|
if ($user === null) {
|
|
$this->error('Kein Benutzer mit dieser E-Mail.');
|
|
|
|
return self::FAILURE;
|
|
}
|
|
|
|
$user->forceFill(['is_operator' => true])->save();
|
|
|
|
$this->info("{$email} ist jetzt Betreiber. Eine bestehende Mandanten-Rolle bleibt.");
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|