Remove/change the default where clauses in relation manager

I am posting this from a discussion on another thread/message: I have built a demo EHR system around medical records- I may not have architectured this correctly but i want to have appointments and prescriptions linked so when a patient gets prescribed something its linked to an appointment, doctor and patient. i created PrescriptionsRelationManager which: * I want to see all the prescriptions for the patient listed in the table not just the ones tied to this appointment_id * but when one is added through the Relation Manager that appointment_id is set i have tried using modifyQueryUsing but i can over write the default where clauses generated ```php ])->modifyQueryUsing(function (Builder $query) { $appointmentId = $this->ownerRecord->id; $patientId = $this->ownerRecord->patient_id; return $query->where(function ($query) use ($appointmentId) { $query->where('appointment_id', $appointmentId) ->orWhereNull('appointment_id'); })->where('patient_id', $patientId); }); still generates the Sql: select count(*) as aggregate from "prescriptions" where "prescriptions"."appointment_id" = 1 and "prescriptions"."appointment_id" is not null and ("appointment_id" = 1 or "appointment_id" is null) and "patient_id" = 1 I want to remove the default where clauses? or is there a different way to do this?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server