From 1da90203e8024c86a65a466699e0853365e76e96 Mon Sep 17 00:00:00 2001 From: isaacclad Date: Fri, 17 Jul 2026 14:11:51 +0000 Subject: [PATCH] Remove Faker from DemoTenantSeeder for --no-dev prod seeds. DemoWorld seeding already used deterministic catalogs; the last randomElement calls blocked production demo:seed without fakerphp/faker. Co-authored-by: Cursor --- app/Services/Care/DemoTenantSeeder.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/app/Services/Care/DemoTenantSeeder.php b/app/Services/Care/DemoTenantSeeder.php index e8b58d3..6bd7890 100644 --- a/app/Services/Care/DemoTenantSeeder.php +++ b/app/Services/Care/DemoTenantSeeder.php @@ -27,8 +27,6 @@ use App\Models\User; use App\Models\Visit; use App\Models\VitalSign; use App\Support\DemoWorld; -use Faker\Factory as FakerFactory; -use Faker\Generator as Faker; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; @@ -97,17 +95,14 @@ class DemoTenantSeeder } return DB::transaction(function () use ($user, $ownerRef, $plan, $volumes) { - $faker = FakerFactory::create(); - $faker->seed(crc32($ownerRef.'|'.$plan)); - $organization = $this->upsertOrganization($user, $ownerRef, $plan, $volumes['branches']); $this->upsertOwnerMember($organization, $ownerRef); - $branches = $this->seedBranches($organization, $ownerRef, $volumes, $faker); + $branches = $this->seedBranches($organization, $ownerRef, $volumes); $this->seedStaffMembers($organization, $ownerRef, $plan, $branches); $departments = $this->seedDepartments($branches, $ownerRef, $volumes); - $practitioners = $this->seedPractitioners($organization, $branches, $departments, $ownerRef, $volumes, $faker); - $patients = $this->seedPatients($organization, $branches, $ownerRef, $volumes, $faker); + $practitioners = $this->seedPractitioners($organization, $branches, $departments, $ownerRef, $volumes); + $patients = $this->seedPatients($organization, $branches, $ownerRef, $volumes); $appointmentCount = $this->seedAppointmentsAndClinical( $organization, $branches, @@ -116,7 +111,6 @@ class DemoTenantSeeder $patients, $ownerRef, $volumes, - $faker, ); if ($volumes['paid_modules']) { @@ -127,7 +121,6 @@ class DemoTenantSeeder $patients, $ownerRef, $volumes, - $faker, ); } @@ -357,7 +350,7 @@ class DemoTenantSeeder * @param array $volumes * @return list */ - private function seedBranches(Organization $organization, string $ownerRef, array $volumes, Faker $faker): array + private function seedBranches(Organization $organization, string $ownerRef, array $volumes): array { $catalog = DemoWorld::branches($this->normalizePlan( (string) data_get($organization->settings, 'plan', 'free') @@ -460,7 +453,6 @@ class DemoTenantSeeder array $departments, string $ownerRef, array $volumes, - Faker $faker, ): array { $practitioners = []; for ($i = 0; $i < $volumes['practitioners']; $i++) { @@ -500,7 +492,6 @@ class DemoTenantSeeder array $branches, string $ownerRef, array $volumes, - Faker $faker, ): array { $worldPeople = DemoWorld::people(); $patients = []; @@ -566,7 +557,6 @@ class DemoTenantSeeder array $patients, string $ownerRef, array $volumes, - Faker $faker, ): int { $statuses = [ Appointment::STATUS_SCHEDULED, @@ -576,6 +566,8 @@ class DemoTenantSeeder Appointment::STATUS_COMPLETED, Appointment::STATUS_CANCELLED, ]; + $reasons = ['Follow-up', 'New complaint', 'Review labs', 'Chronic care']; + $symptoms = ['Fever', 'Cough', 'Headache', 'Fatigue']; $count = 0; for ($i = 0; $i < $volumes['appointments']; $i++) { @@ -629,7 +621,7 @@ class DemoTenantSeeder 'cancelled_at' => $status === Appointment::STATUS_CANCELLED ? $scheduledAt->copy()->subHour() : null, - 'reason' => $faker->randomElement(['Follow-up', 'New complaint', 'Review labs', 'Chronic care']), + 'reason' => $reasons[$i % count($reasons)], 'created_by' => $ownerRef, 'deleted_at' => null, ], @@ -645,7 +637,7 @@ class DemoTenantSeeder 'practitioner_id' => $practitioner->id, 'patient_id' => $patient->id, 'status' => Consultation::STATUS_COMPLETED, - 'symptoms' => $faker->randomElement(['Fever', 'Cough', 'Headache', 'Fatigue']), + 'symptoms' => $symptoms[$i % count($symptoms)], 'clinical_notes' => 'Demo consultation notes.', 'started_at' => $scheduledAt->copy()->addMinutes(15), 'completed_at' => $scheduledAt->copy()->addHour(), @@ -693,7 +685,6 @@ class DemoTenantSeeder array $patients, string $ownerRef, array $volumes, - Faker $faker, ): void { $types = []; foreach ([