34 lines
937 B
PHP
34 lines
937 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class AdminUserSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// Create an admin user if it doesn't exist
|
|
$user = User::firstOrCreate(
|
|
['email' => 'admin@bratanbonus.test'],
|
|
[
|
|
'name' => 'Admin Bratan',
|
|
'password' => Hash::make('password'),
|
|
'role' => 'admin',
|
|
]
|
|
);
|
|
|
|
$this->command->info('Admin User created successfully!');
|
|
$this->command->info('--------------------------------');
|
|
$this->command->info('Email: ' . $user->email);
|
|
$this->command->info('Password: password');
|
|
$this->command->info('Role: ' . $user->role);
|
|
$this->command->info('--------------------------------');
|
|
}
|
|
}
|