users menu listing

This commit is contained in:
Mark Gregory
2026-08-26 08:20:59 +01:00
parent 31ee06fa3a
commit 381d58003d
8 changed files with 103 additions and 13 deletions
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace Modules\UserManagement\Console;
use App\Models\User;
use Illuminate\Console\Command;
final class EnsureAdminCommand extends Command
{
protected $signature = 'users:ensure-admin {user=1 : User ID to grant administrator access}';
protected $description = 'Ensure a user has Helpdesk administrator and agent access';
public function handle(): int
{
$user = User::query()->find((int) $this->argument('user'));
if ($user === null) {
$this->error('User not found.');
return self::FAILURE;
}
$user->forceFill([
'helpdesk_admin' => true,
'helpdesk_agent' => true,
])->save();
$this->info("{$user->name} is now a Helpdesk administrator.");
return self::SUCCESS;
}
}