Get number of patients with incomplete medications and Patient name with medication details.
I tried this in my PatientsController index method
$ontreatment = Patient::all()->medications->where('completed', false)->get();
My Patient.php has relationship as follows
public function medications()
{
return $this->hasMany('App\Medication');
}
My Medication.php model has following relationship: public function patients()
{ return $this->belongsTo('App\Patient');
}
my route is like following: Route::get('/patients', 'PatientsController@index');
No. of patients who have not completed their medication and a table with patient name and medication details(Clinician,treatment,treatmentDate...) if treatment is incomplete.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire