public static function blocked($ip) { $model = YBoardIpaddress::find()->where(['ip' => $ip])->one(); if ($model === null) { return false; } else { $model->updateCounters(['count' => 1]); // method since Yii 1.1.8 return true; } }
public function blocked($attribute, $params) { if (YBoardIpaddress::blocked($this->ip)) { $this->addError('ip', YBoard::t('yboard', 'Your IP address has been blocked.')); } }