feat: implement product management module with CRUD operations, service layer, and validation logic
This commit is contained in:
@@ -277,4 +277,27 @@ class ProductService
|
||||
|
||||
return $products;
|
||||
}
|
||||
|
||||
public function getProductDetail(Tenant $tenant, Product $product): Product
|
||||
{
|
||||
$product->load([
|
||||
'attachments',
|
||||
'brand',
|
||||
'category',
|
||||
'attributes.options',
|
||||
]);
|
||||
|
||||
$defaultVariant = $product->variants()
|
||||
->with([
|
||||
'attachments',
|
||||
'definitions.attribute.options',
|
||||
])
|
||||
->first();
|
||||
|
||||
if ($defaultVariant) {
|
||||
$product->setDefaultVariant($defaultVariant);
|
||||
}
|
||||
|
||||
return $product;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user