/** * @inheritdoc */ public function down() { $this->dropForeignKey($this->getForeignKeyRelationTag(), Tag::relationTableName()); $this->dropTable(Tag::relationTableName()); $this->dropTable(Tag::tableName()); }
/** * Filters the tags by the association type. * * @param $type string * @return $this */ public function filterType($type) { return $this->innerJoin(Tag::relationTableName(), Tag::relationTableName() . '.`tag_id` = ' . Tag::tableName() . '.`id`')->andWhere([Tag::relationTableName() . '.`association_type`' => $type])->groupBy([Tag::tableName() . '.`id`']); }