114 lines
3.2 KiB
PHP
114 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\User;
|
|
use Hash;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class UserSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
//updateOrCreate
|
|
$user1 = User::updateOrCreate(
|
|
// Unique identifier
|
|
['email' => 'admin@cripumps.com'],
|
|
|
|
// Data to update/create
|
|
[
|
|
'name' => 'Admin',
|
|
'password' => Hash::make('admin'),
|
|
'updated_at' => now(),
|
|
'created_at' => now()
|
|
]
|
|
);
|
|
// $user1 = User::firstOrCreate([
|
|
// 'name' => 'Admin',
|
|
// 'email' => 'admin@cripumps.com',
|
|
// 'password' => bcrypt('admin'),
|
|
// ]);
|
|
$user1->assignRole('Super Admin');
|
|
|
|
$user2 = User::updateOrCreate(
|
|
// Unique identifier
|
|
['email' => 'jothi@cripumps.com'],
|
|
|
|
// Data to update/create
|
|
[
|
|
'name' => 'Jothi',
|
|
'password' => bcrypt('jothi@123'),
|
|
'updated_at' => now(),
|
|
'created_at' => now()
|
|
]
|
|
);
|
|
// $user2 = User::firstOrCreate([
|
|
// 'name' => 'Jothi',
|
|
// 'email' => 'jothi@cripumps.com',
|
|
// 'password' => bcrypt('jothi@123'),
|
|
// ]);
|
|
$user2->assignRole('Super Admin');
|
|
|
|
$user3 = User::updateOrCreate(
|
|
// Unique identifier
|
|
['email' => 'dhana@cripumps.com'],
|
|
|
|
// Data to update/create
|
|
[
|
|
'name' => 'Dhana',
|
|
'password' => bcrypt('dhana@123'),
|
|
'updated_at' => now(),
|
|
'created_at' => now()
|
|
]
|
|
);
|
|
// $user3 = User::firstOrCreate([
|
|
// 'name' => 'Dhana',
|
|
// 'email' => 'dhana@cripumps.com',
|
|
// 'password' => bcrypt('dhana@123'),
|
|
// ]);
|
|
$user3->assignRole('Super Admin');
|
|
|
|
$user4 = User::updateOrCreate(
|
|
// Unique identifier
|
|
['email' => 'ranjith@cripumps.com'],
|
|
|
|
// Data to update/create
|
|
[
|
|
'name' => 'Ranjith',
|
|
'password' => bcrypt('ranjith@123'),
|
|
'updated_at' => now(),
|
|
'created_at' => now()
|
|
]
|
|
);
|
|
// $user4 = User::firstOrCreate([
|
|
// 'name' => 'Ranjith',
|
|
// 'email' => 'ranjith@cripumps.com',
|
|
// 'password' => bcrypt('ranjith@123'),
|
|
// ]);
|
|
$user4->assignRole('Super Admin');
|
|
|
|
$user5 = User::updateOrCreate(
|
|
// Unique identifier
|
|
['email' => 'srimathi@cripumps.com'],
|
|
|
|
// Data to update/create
|
|
[
|
|
'name' => 'Srimathi',
|
|
'password' => bcrypt('srimathi@123'),
|
|
'updated_at' => now(),
|
|
'created_at' => now()
|
|
]
|
|
);
|
|
// $user5 = User::firstOrCreate([
|
|
// 'name' => 'Srimathi',
|
|
// 'email' => 'srimathi@cripumps.com',
|
|
// 'password' => bcrypt('srimathi@123'),
|
|
// ]);
|
|
$user5->assignRole('Super Admin');
|
|
// User::factory()->count(5)->create();
|
|
}
|
|
}
|