public function findUserAttr($id) { $model = Userlogin::find()->select('*')->joinWith('emp', true, 'LEFT JOIN')->Where(['wnd_admin.user.id' => $id]); //->one(); if ($model !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getUser() { return $this->hasOne(Userlogin::className(), ['EMP_ID' => 'EMP_ID']); }
/** * CLASS TABLE FIND PrimaryKey * Example: Employe::find() */ protected function findModel($id) { if (($model = Userlogin::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }