public function viewModel($id) { $model = SuperPremium::findOne($id); $model->join('LEFT JOIN', 'users', 'SuperPremium.client = users.id_user and SuperPremium.manager = users.id_user')->addSelect(['SuperPremium.*', 'users.first_name'])->where(['id' => $id])->all(); return $model; }
/** * Finds the SuperPremium model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SuperPremium the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SuperPremium::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }