public function getAttributeCategory() { return ProductAttributeCategory::softFind()->select('product_attribute_category.*')->leftJoin(ProductAttribute::tableName(), '`product_attribute_category`.`id` = `product_attribute`.`category_id`')->leftJoin(ProductAttributeAssignment::tableName(), '`product_attribute_assignment`.`attribute_id` = `product_attribute`.`id`')->leftJoin(static::tableName(), '`product`.`id` = `product_attribute_assignment`.`product_id`')->where(['product.id' => $this->id]); }
public function down() { $this->dropPrimaryKey('primary key', ProductAttributeAssignment::tableName()); }