/**
  * Tags relation
  * @return static
  */
 public function getTags()
 {
     return is_array($this->_tags) ? Tag::findAll(['id' => $this->_tags]) : $this->owner->hasMany(Tag::className(), ['id' => 'tag_id'])->viaTable(Tag::pivotTableName(), ['item_id' => 'id'], function ($query) {
         /** @var $query ActiveQuery */
         $query->andWhere(['item_class' => $query->modelClass]);
     })->indexBy('id');
 }
 /**
  * @return Response
  * @throws \Exception
  */
 public function actionBulkDelete()
 {
     $data = Yii::$app->request->getBodyParam('data', []);
     $models = Tag::findAll(['id' => $data]);
     foreach ($models as $model) {
         $model->delete();
     }
     return $this->redirect(ArrayHelper::getValue(Yii::$app->request, 'referrer', ['index']));
 }