20] ]; } public function attributeLabels() { return [ "password" => Yii::t('app', 'Password'), ]; } public function checkPassword($id) { if( $this->password == Article::findOne($id)['password'] ){ $session = Yii::$app->getSession(); $session->set("article_password_" . $id, true); return true; } $this->addError('password', Yii::t('frontend', 'Password error')); return false; } }