- Replace is_admin boolean with role enum('super_admin','admin') via migration
- ProgramPolicy: admin program can only view/edit/delete own programs
- EnsureIsAdmin: accepts both roles; EnsureSuperAdmin: super_admin only
- UserController + views: super_admin can manage admin accounts
- Sidebar: user management link & role badge gated on isSuperAdmin()
- Fix Controller base class: add AuthorizesRequests trait
- Fix tests: replace nonAdmin() (invalid enum) with adminProgram() against super_admin-only route
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
25 lines
571 B
PHP
25 lines
571 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class AdminSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
User::firstOrCreate(
|
|
['email' => 'admin@mbip.gov.my'],
|
|
[
|
|
'name' => 'Admin eCert MBIP',
|
|
'password' => Hash::make('Admin@MBIP2025!'),
|
|
'role' => 'super_admin',
|
|
]
|
|
);
|
|
|
|
$this->command->info('Admin account created: admin@mbip.gov.my / Admin@MBIP2025!');
|
|
}
|
|
}
|