Remove Faker from DemoTenantSeeder for --no-dev prod seeds.
Deploy Ladill Care / deploy (push) Successful in 1m51s

DemoWorld seeding already used deterministic catalogs; the last randomElement calls blocked production demo:seed without fakerphp/faker.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 14:11:51 +00:00
co-authored by Cursor
parent dd4efec135
commit 1da90203e8
+8 -17
View File
@@ -27,8 +27,6 @@ use App\Models\User;
use App\Models\Visit; use App\Models\Visit;
use App\Models\VitalSign; use App\Models\VitalSign;
use App\Support\DemoWorld; use App\Support\DemoWorld;
use Faker\Factory as FakerFactory;
use Faker\Generator as Faker;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@@ -97,17 +95,14 @@ class DemoTenantSeeder
} }
return DB::transaction(function () use ($user, $ownerRef, $plan, $volumes) { 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']); $organization = $this->upsertOrganization($user, $ownerRef, $plan, $volumes['branches']);
$this->upsertOwnerMember($organization, $ownerRef); $this->upsertOwnerMember($organization, $ownerRef);
$branches = $this->seedBranches($organization, $ownerRef, $volumes, $faker); $branches = $this->seedBranches($organization, $ownerRef, $volumes);
$this->seedStaffMembers($organization, $ownerRef, $plan, $branches); $this->seedStaffMembers($organization, $ownerRef, $plan, $branches);
$departments = $this->seedDepartments($branches, $ownerRef, $volumes); $departments = $this->seedDepartments($branches, $ownerRef, $volumes);
$practitioners = $this->seedPractitioners($organization, $branches, $departments, $ownerRef, $volumes, $faker); $practitioners = $this->seedPractitioners($organization, $branches, $departments, $ownerRef, $volumes);
$patients = $this->seedPatients($organization, $branches, $ownerRef, $volumes, $faker); $patients = $this->seedPatients($organization, $branches, $ownerRef, $volumes);
$appointmentCount = $this->seedAppointmentsAndClinical( $appointmentCount = $this->seedAppointmentsAndClinical(
$organization, $organization,
$branches, $branches,
@@ -116,7 +111,6 @@ class DemoTenantSeeder
$patients, $patients,
$ownerRef, $ownerRef,
$volumes, $volumes,
$faker,
); );
if ($volumes['paid_modules']) { if ($volumes['paid_modules']) {
@@ -127,7 +121,6 @@ class DemoTenantSeeder
$patients, $patients,
$ownerRef, $ownerRef,
$volumes, $volumes,
$faker,
); );
} }
@@ -357,7 +350,7 @@ class DemoTenantSeeder
* @param array<string, mixed> $volumes * @param array<string, mixed> $volumes
* @return list<Branch> * @return list<Branch>
*/ */
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( $catalog = DemoWorld::branches($this->normalizePlan(
(string) data_get($organization->settings, 'plan', 'free') (string) data_get($organization->settings, 'plan', 'free')
@@ -460,7 +453,6 @@ class DemoTenantSeeder
array $departments, array $departments,
string $ownerRef, string $ownerRef,
array $volumes, array $volumes,
Faker $faker,
): array { ): array {
$practitioners = []; $practitioners = [];
for ($i = 0; $i < $volumes['practitioners']; $i++) { for ($i = 0; $i < $volumes['practitioners']; $i++) {
@@ -500,7 +492,6 @@ class DemoTenantSeeder
array $branches, array $branches,
string $ownerRef, string $ownerRef,
array $volumes, array $volumes,
Faker $faker,
): array { ): array {
$worldPeople = DemoWorld::people(); $worldPeople = DemoWorld::people();
$patients = []; $patients = [];
@@ -566,7 +557,6 @@ class DemoTenantSeeder
array $patients, array $patients,
string $ownerRef, string $ownerRef,
array $volumes, array $volumes,
Faker $faker,
): int { ): int {
$statuses = [ $statuses = [
Appointment::STATUS_SCHEDULED, Appointment::STATUS_SCHEDULED,
@@ -576,6 +566,8 @@ class DemoTenantSeeder
Appointment::STATUS_COMPLETED, Appointment::STATUS_COMPLETED,
Appointment::STATUS_CANCELLED, Appointment::STATUS_CANCELLED,
]; ];
$reasons = ['Follow-up', 'New complaint', 'Review labs', 'Chronic care'];
$symptoms = ['Fever', 'Cough', 'Headache', 'Fatigue'];
$count = 0; $count = 0;
for ($i = 0; $i < $volumes['appointments']; $i++) { for ($i = 0; $i < $volumes['appointments']; $i++) {
@@ -629,7 +621,7 @@ class DemoTenantSeeder
'cancelled_at' => $status === Appointment::STATUS_CANCELLED 'cancelled_at' => $status === Appointment::STATUS_CANCELLED
? $scheduledAt->copy()->subHour() ? $scheduledAt->copy()->subHour()
: null, : null,
'reason' => $faker->randomElement(['Follow-up', 'New complaint', 'Review labs', 'Chronic care']), 'reason' => $reasons[$i % count($reasons)],
'created_by' => $ownerRef, 'created_by' => $ownerRef,
'deleted_at' => null, 'deleted_at' => null,
], ],
@@ -645,7 +637,7 @@ class DemoTenantSeeder
'practitioner_id' => $practitioner->id, 'practitioner_id' => $practitioner->id,
'patient_id' => $patient->id, 'patient_id' => $patient->id,
'status' => Consultation::STATUS_COMPLETED, 'status' => Consultation::STATUS_COMPLETED,
'symptoms' => $faker->randomElement(['Fever', 'Cough', 'Headache', 'Fatigue']), 'symptoms' => $symptoms[$i % count($symptoms)],
'clinical_notes' => 'Demo consultation notes.', 'clinical_notes' => 'Demo consultation notes.',
'started_at' => $scheduledAt->copy()->addMinutes(15), 'started_at' => $scheduledAt->copy()->addMinutes(15),
'completed_at' => $scheduledAt->copy()->addHour(), 'completed_at' => $scheduledAt->copy()->addHour(),
@@ -693,7 +685,6 @@ class DemoTenantSeeder
array $patients, array $patients,
string $ownerRef, string $ownerRef,
array $volumes, array $volumes,
Faker $faker,
): void { ): void {
$types = []; $types = [];
foreach ([ foreach ([