Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save besabellacyrus/28f16853ec04812f2895782497350999 to your computer and use it in GitHub Desktop.
Save besabellacyrus/28f16853ec04812f2895782497350999 to your computer and use it in GitHub Desktop.
How to get relationship fuelcms
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