Commit 9f5b5cfe authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавили проверку на дублирование подписки на блоги

parent cb96689b
......@@ -91,6 +91,19 @@ class Bid extends \common\components\ActiveRecordModel
];
}
public function beforeSave($insert){
if (parent::beforeSave($insert))
return false;
if (!is_null($this->email)) {
if (Bid::find()->where(['email' => $this->email])->exists()===true) {
$this->addError('email', 'Вы уже подписаны на новости блога');
return false;
}
}
return true;
}
/**
* @inheritdoc
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment