public static function findIdentity($kd_dosen) { //mencari user login berdasarkan IDnya dan hanya dicari 1. $user = Dosen::findOne(['kd_dosen' => $kd_dosen]); if (count($user)) { return new static($user); // return valid; } return null; }
/** * Finds the Dosen model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Dosen the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Dosen::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }