public function getArticleImg() { return $this->hasMany(ArticlesImg::className(), ['article_id' => 'id']); }
public function actionDeleteImg() { if (isset($_POST['file'])) { if (file_exists('images/articles/' . $_POST['id'] . '/' . $_POST['file'])) { unlink('images/articles/' . $_POST['id'] . '/' . $_POST['file']); ArticlesImg::deleteAll(['article_id' => $_POST['id'], 'img_url' => $_POST['file']]); } else { echo 'false img'; } } else { echo 'false'; } }