join('attribute_groups', 'attribute_group_mappings.attribute_group_id', '=', 'attribute_groups.id') ->join('attribute_families', 'attribute_groups.attribute_family_id', '=', 'attribute_families.id') ->where('attribute_families.id', $this->id) ->select('attributes.*'); } /** * Get all of the comparable attributes which belongs to attribute family. */ public function getComparableAttributesBelongsToFamily() { return (AttributeProxy::modelClass())::join('attribute_group_mappings', 'attribute_group_mappings.attribute_id', '=', 'attributes.id') ->select('attributes.*')->where('attributes.is_comparable', 1)->distinct()->get(); } /** * Get all of the attributes for the attribute groups. */ public function getCustomAttributesAttribute() { return $this->custom_attributes()->get(); } /** * Get all of the attribute groups. */ public function attribute_groups() { return $this->hasMany(AttributeGroupProxy::modelClass())->orderBy('position'); } /** * Get all of the attributes for the attribute groups. */ public function getConfigurableAttributesAttribute() { return $this->custom_attributes()->where('attributes.is_configurable', 1)->where('attributes.type', 'select')->get(); } /** * Get all of the products. */ public function products() { return $this->hasMany(ProductProxy::modelClass()); } }