VU
Size: a a a
VU
VU
SG
SG
VU
SG
SG
VU
SG
SG
SG
VU
SG
VU
SG
SG
VU
foreach ($attributesProducts as $attributeProduct){
$idProperty = $attributeProduct->attribute->property->id;
$filtersProducts[$idProperty]["property"] = $attributeProduct->attribute->property;
$chooseFilterValue = $request->input('filter_' . $idProperty);
if ($request->has('filter_' . $idProperty) && in_array($attributeProduct->attribute->id, $chooseFilterValue)) {
$attributeProduct->attribute->checked = true;
$changeFilters = true;
}else{
$attributeProduct->attribute->checked = false;
}
$filtersProducts[$attributeProduct->attribute->property->id]["value"][] = $attributeProduct->attribute;
}
SG
foreach ($attributesProducts as $attributeProduct){
$idProperty = $attributeProduct->attribute->property->id;
$filtersProducts[$idProperty]["property"] = $attributeProduct->attribute->property;
$chooseFilterValue = $request->input('filter_' . $idProperty);
if ($request->has('filter_' . $idProperty) && in_array($attributeProduct->attribute->id, $chooseFilterValue)) {
$attributeProduct->attribute->checked = true;
$changeFilters = true;
}else{
$attributeProduct->attribute->checked = false;
}
$filtersProducts[$attributeProduct->attribute->property->id]["value"][] = $attributeProduct->attribute;
}
SG
foreach ($attributesProducts as $attributeProduct){
$idProperty = $attributeProduct->attribute->property->id;
$filtersProducts[$idProperty]["property"] = $attributeProduct->attribute->property;
$chooseFilterValue = $request->input('filter_' . $idProperty);
if ($request->has('filter_' . $idProperty) && in_array($attributeProduct->attribute->id, $chooseFilterValue)) {
$attributeProduct->attribute->checked = true;
$changeFilters = true;
}else{
$attributeProduct->attribute->checked = false;
}
$filtersProducts[$attributeProduct->attribute->property->id]["value"][] = $attributeProduct->attribute;
}
Attribute::query()
->with('property')
->whereHas('products', function($q) use ($productsId) {
$q->whereIn('products.id', $productsId);
)
->get(['id', 'property_id']);
VU