From cfb6fda288ced4d155236f2761d42f326130d766 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Thu, 25 Sep 2025 16:43:58 +0700 Subject: [PATCH] fix contact index --- app/Controllers/Contact.php | 2 +- app/Controllers/PatVisit.php | 3 +++ app/Models/ContactModel.php | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Controllers/Contact.php b/app/Controllers/Contact.php index 65bd62a..6a23034 100644 --- a/app/Controllers/Contact.php +++ b/app/Controllers/Contact.php @@ -20,7 +20,7 @@ class Contact extends Controller { public function index() { $model = new ContactModel(); - $rows = $model->getContactsWithDetail(); + $rows = $model->getContacts(); if (empty($rows)) { return $this->respond([ diff --git a/app/Controllers/PatVisit.php b/app/Controllers/PatVisit.php index c4f3573..b858d94 100644 --- a/app/Controllers/PatVisit.php +++ b/app/Controllers/PatVisit.php @@ -10,6 +10,9 @@ use App\Models\CounterModel; class PatVisit extends Controller { use ResponseTrait; + protected $db; + protected $visnum_prefix; + public function __construct() { $this->db = \Config\Database::connect(); $this->visnum_prefix = "DV"; diff --git a/app/Models/ContactModel.php b/app/Models/ContactModel.php index 1dd712d..f76e86e 100644 --- a/app/Models/ContactModel.php +++ b/app/Models/ContactModel.php @@ -18,6 +18,11 @@ class ContactModel extends Model { return $rows; } + public function getContacts() { + $rows = $this->select("ContactID, NameFirst, NameLast, Title, Initial, Specialty")->get()->getResultArray(); + return $rows; + } + public function getContactWithDetail($ContactID) { $rows = $this->where('contact.ContactID', $ContactID)->join('contactdetail cd', 'contact.ContactID=cd.ContactID','left')->get()->getResultArray(); $contact = [