initial commit

This commit is contained in:
2026-06-23 13:28:38 +07:00
commit 966ed115b2
590 changed files with 111412 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace Database\Seeders;
use App\Models\Doctor;
use App\Models\Patient;
use App\Models\User;
use Illuminate\Database\Seeder;
use Hash;
class PatientSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
for ($x = 1; $x <= 25; $x++){
$user = User::create([
'email' => 'patient'.$x.'@mail.com',
'password' => Hash::make('password')
]);
$user->assignRole('patient');
$genders = collect(['male','female']);
$conditions = collect(['normal','mi']);
$patient = Patient::create([
'id' => fake()->uuid(),
'user_id' => $user->id,
'fullname' => fake()->name(),
'address' => fake()->address(),
'phone' => fake()->phoneNumber(),
'emergency_phone' => fake()->phoneNumber(),
'gender' => $genders->shuffle()->first(),
'age' => rand(9,70),
'device_id' => fake()->uuid(),
'condition' => $conditions->shuffle()->first(),
]);
}
$patients = Patient::all();
foreach ($patients as $p){
$doctor = Doctor::inRandomOrder()->first();
$p->doctors()->attach($doctor);
}
}
}