Created
May 22, 2017 08:58
-
-
Save besabellacyrus/28f16853ec04812f2895782497350999 to your computer and use it in GitHub Desktop.
How to get relationship fuelcms
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
function doctor_profile($slug = NULL) | |
{ | |
$data['doctor'] = fuel_model( | |
'doctors', | |
array( | |
'find' => 'one', | |
'where' => array('slug' => $slug), | |
'return_method' => 'object' | |
) | |
); | |
$specialties = array(); | |
$hospitals = array(); | |
$focus = array(); | |
foreach ($data['doctor']->specialties as $s) { | |
$specialties[] = $s->title; | |
} | |
foreach ($data['doctor']->hospitals as $h) { | |
$hospitals[] = $h->name; | |
} | |
foreach ($data['doctor']->focuses as $f) { | |
$focus[] = $f->title; | |
} | |
$this->load->model('doctors_model'); | |
$data['schedules'] = $this->doctors_model->get_schedules($slug); | |
$data['specialties'] = $specialties ? implode(', ', $specialties) : 'No data available.'; | |
$data['clinics'] = $hospitals ? implode(', ', $hospitals) : 'No data available.'; | |
$data['clinical_focus'] = $focus ? implode(', ', $focus) : 'No data available.'; | |
// var_dump($data['schedules']);die; | |
$this->fuel->pages->render('doctor-profile', $data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment