41 lines
987 B
PHP
41 lines
987 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class DatabaseSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Seed the application's database.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// Seed default Admin
|
|
DB::table('admin')->updateOrInsert(
|
|
['username' => 'admin'],
|
|
[
|
|
'password' => Hash::make('password'),
|
|
]
|
|
);
|
|
|
|
// Seed default User
|
|
DB::table('user')->updateOrInsert(
|
|
['username' => 'user'],
|
|
[
|
|
'email' => 'user@example.com',
|
|
'password' => Hash::make('password'),
|
|
'phone_number' => '081234567890',
|
|
'role' => 'user',
|
|
]
|
|
);
|
|
|
|
// Seed sample categories if CategorySeeder exists
|
|
if (class_exists(CategorySeeder::class)) {
|
|
$this->call(CategorySeeder::class);
|
|
}
|
|
}
|
|
}
|