Heera/database/seeders/DatabaseSeeder.php

40 lines
922 B
PHP
Raw Permalink Normal View History

2024-05-16 03:46:08 +00:00
<?php
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Hash;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
$this->callOnce([
CountrySeeder::class,
ProvinceSeeder::class,
DistrictSeeder::class,
MunicipalitySeeder::class,
DropdownSeeder::class,
]);
$admin = \App\Models\User::factory()->create([
'name' => 'Admin User',
'email' => 'admin@gmail.com',
'employee_id' => null,
'password' => Hash::make('password'),
]);
$adminRole = Role::create(['name' => 'admin']);
$memberRole = Role::create(['name' => 'employee']);
$admin->assignRole($adminRole);
}
}