Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Feb 13, 2024
1 parent 22a7c7b commit 50fb554
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Fields/Variants.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ public function fields(Request $request): array

BelongsToMany::make(__('Property Values'), 'propertyValues')
->withRelatableQuery(static function (Request $request, Builder $query, Variant $model): Builder {
$product = $model->relationLoaded('product')
? $model->product
: $model->product()->make()->forceFill(['id' => $model->product_id]);

return $query->whereIn(
$query->qualifyColumn('id'),
$model->product->propertyValues()->select('bazar_property_values.id')
$product->propertyValues()->select('bazar_property_values.id')
);
})
->with(['property'])
Expand Down

0 comments on commit 50fb554

Please sign in to comment.