public function syncWithProductType(ProductTypeContract $productType, $attributeIds, array $requiredAttributes = [])
    {
        $attributeIds = is_array($attributeIds) ? $attributeIds : [$attributeIds];

        $pivot = [];
        foreach ($attributeIds as $id) {
            $pivot[$id] = ['required' => in_array($id, $requiredAttributes)];
        }

        return $productType->attributes()->sync($pivot);
    }
public function syncWithProductType(ProductTypeContract $productType, $attributeIds, array $requiredAttributes = [])
    {
        $attributeIds = is_array($attributeIds) ? $attributeIds : [$attributeIds];

        $pivot = [];
        foreach ($attributeIds as $id) {
            $pivot[$id] = ['required' => in_array($id, $requiredAttributes)];
        }

        return $productType->attributes()->sync($pivot);
    }
public function syncWithProductType ( ProductTypeContract $ productType , $ attributeIds , array $ requiredAttributes = [ ] ) { $ attributeIds = is_array ( $ attributeIds ) ? $ attributeIds : [ $ attributeIds ] ; $ pivot = [ ] ; foreach ( $ attributeIds as $ id ) { $ pivot [ $ id ] = [ 'required' => in_array ( $ id , $ requiredAttributes ) ] ; } return $ productType -> attributes ( ) -> sync ( $ pivot ) ; }
Relates attributes to a product type.

@param ProductTypeContract $productType
@param int|array $attributeIds
@param array $requiredAttributes
@return array
Relates attributes to a product type .