Skip to content

Instantly share code, notes, and snippets.

public function edit($id = null) {
$conditions=['User.id' => $id]; // check the ID of the User to be edited exists and...
if(!$this->isAdmin()){ // if not Admin the User to be edited must belong to the Doctor
$conditions[] = ['User.doctor_id' => $this->Auth->user('id')];
}
if (!$user=$this->User->find('first', ['conditions' => $conditions])) { // if the check fails return a 404
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Survey Results</h3>
</div>