代码格式优化
This commit is contained in:
parent
0eda9b8cec
commit
7e569330d7
|
|
@ -191,11 +191,13 @@ class ProductRepo
|
|||
return $attributes;
|
||||
}
|
||||
|
||||
public static function getFilterAttribute($data)
|
||||
public static function getFilterAttribute($data): array
|
||||
{
|
||||
$builder = self::getBuilder($data)->with(['attributes.attribute.description', 'attributes.attribute_value.description'])->leftJoin('product_attributes as pa', 'pa.product_id', 'products.id')
|
||||
->whereNotNull('pa.attribute_id')
|
||||
$builder = self::getBuilder($data)
|
||||
->select(['pa.attribute_id', 'pa.attribute_value_id'])
|
||||
->with(['attributes.attribute.description', 'attributes.attribute_value.description'])
|
||||
->leftJoin('product_attributes as pa', 'pa.product_id', 'products.id')
|
||||
->whereNotNull('pa.attribute_id')
|
||||
->distinct()
|
||||
->reorder('pa.attribute_id');
|
||||
$productAttributes = $builder->get()->toArray();
|
||||
|
|
|
|||
Loading…
Reference in New Issue