base commit
This commit is contained in:
29
database/seeders/AdminUserSeeder.php
Normal file
29
database/seeders/AdminUserSeeder.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Department;
|
||||
use App\Models\User;
|
||||
use BezhanSalleh\FilamentShield\Support\Utils;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AdminUserSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$admin = User::query()->updateOrCreate(
|
||||
['email' => 'admin@company.com'],
|
||||
[
|
||||
'name' => 'Admin',
|
||||
'password' => Hash::make('password'),
|
||||
'email_verified_at' => now(),
|
||||
'department_id' => Department::query()->where('code', 'ADM')->value('id'),
|
||||
],
|
||||
);
|
||||
|
||||
$admin->assignRole(Utils::getSuperAdminName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user