/var/www/vhosts/nabawater/backend/models
Edit: /var/www/vhosts/nabawater/backend/models/FaqLang.php (1845B)
Yii::t('backend', 'Question'),
'answer' => Yii::t('backend', 'Answer'),
];
}
public function uniqueValidation()
{
if(is_array($this->question)){
foreach ($this->question as $key => $value) {
$model = FaqLang::find()
->alias('FL')
->innerJoin(['F' => Faq::tableName()], 'F.faq_id = FL.faq_id')
->where([
'FL.question' => $this->question[$key],
'FL.language_code' => $key
])
->andWhere(['<>', 'F.status', self::DELETE]);
if(!empty($this->category_lang_id[$key])){
$model->andWhere(['<>', 'FL.faq_lang_id', $this->faq_lang_id[$key]]);
}
$model=$model->one();
if ($model !== null) {
$this->addError("question", ''.$this->question[$key].' has been already taken',[]);
}
}
}
}
}