StocksNew/database/seeders/DatabaseSeeder.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

43 lines
1.0 KiB
PHP

<?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,
DepartmentSeeder::class,
DesignationSeeder::class,
DropdownSeeder::class,
]);
$admin = \App\Models\User::factory()->create([
'name' => 'Admin User',
'email' => 'admin@gmail.com',
'employee_id' => 1,
'password' => Hash::make('password'),
]);
$adminRole = Role::create(['name' => 'admin']);
$memberRole = Role::create(['name' => 'hr']);
$memberRole = Role::create(['name' => 'employee']);
$admin->assignRole($adminRole);
}
}