Created
March 21, 2017 03:59
-
-
Save iaditya/16b8f89b56c9271051f456f81aafa3df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//using on patientDashboard - from today | |
public function nextAppointment($patient_id) { | |
$start = Time::now()->toDateString(); // today | |
$event = $this->Events->findByPatientId($patient_id) | |
->contain(['Facilities', 'Providers' => ['Users']]) | |
->where(['Events.start >= :now']) | |
->bind(':now', $start, 'time')->first(); | |
$this->set(compact('event')); | |
} | |
//using on patientDashboard - last recent appointment | |
public function lastAppointment($patient_id) { | |
$start = Time::now()->toDateString(); // today | |
$event = $this->Events->findByPatientId($patient_id) | |
->contain(['Facilities', 'Providers' => ['Users']]) | |
->where(['Events.start < :now']) | |
->order(['Events.id' => 'DESC']) | |
->bind(':now', $start, 'time') | |
->first(); | |
$this->set(compact('event')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment