/** * Finds the Client model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Client the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Client::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
protected function findModel($id) { if (($model = Client::findOne($id)) !== null) { return $model; } else { if ($this->user->id_user_role == 1 || $this->user->id_user_role == 3) { //betterdebt or advisor $location = 'index'; } elseif ($this->user->id_user_role == 4) { //client $location = '../loan/index'; } echo "<script text='javascript'>alert('The client does not exist!');parent.location.href = '{$location}';window.event.returnValue=false;</script>"; exit; throw new NotFoundHttpException('The requested page does not exist.'); } }