Files
GSB-Construction/assign_admin_role.php
Ajjj 936ae1c6b2
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled
feat: implement comprehensive dashboard controller and modular administrative and project management interfaces
2026-08-03 18:28:52 +08:00

16 lines
522 B
PHP

<?php
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
$u = \App\Models\User::where('email', 'admin@example.com')->first();
if ($u) {
$role = \Spatie\Permission\Models\Role::firstOrCreate(['name' => 'admin']);
$u->assignRole($role);
echo "Assigned 'admin' role to admin@example.com successfully!" . PHP_EOL;
} else {
echo "User admin@example.com not found." . PHP_EOL;
}