Build: Database setup

This commit is contained in:
Sallu9007
2025-01-26 00:46:53 +05:30
parent a79095624e
commit 54647b58f4
6 changed files with 157 additions and 3 deletions

View File

@@ -15,9 +15,14 @@ class DatabaseSeeder extends Seeder
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
$this->call([
RoleSeeder::class,
DepartmentSeeder::class,
]);
// User::factory()->create([
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DepartmentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('roles')->insert([
['name' => 'Admin'],
['name' => 'Coordinator'],
['name' => 'Faculty'],
]);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class RoleSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('departments')->insert([
['name' => 'Computer Engineering'],
['name' => 'Information Technology'],
['name' => 'Mechanical Engineering'],
['name' => 'Electrical Engineering'],
['name' => 'Civil Engineering'],
]);
}
}