feat: add brand and category relationships to products, update requests and resources, and seed product catalog from images
This commit is contained in:
@@ -20,7 +20,7 @@ class ProductController extends Controller
|
||||
return ProductResource::collection(
|
||||
Product::query()
|
||||
->where('tenant_codigo', $tenant->codigo)
|
||||
->with('attachments')
|
||||
->with(['attachments', 'brand', 'category'])
|
||||
->latest()
|
||||
->paginateFromRequest()
|
||||
)->response();
|
||||
@@ -37,7 +37,13 @@ class ProductController extends Controller
|
||||
{
|
||||
$producto = $this->resolveScopedProduct($tenant, $producto);
|
||||
|
||||
return ProductResource::make($producto->load(['attachments', 'variants.definitions.attribute', 'variants.attachments']));
|
||||
return ProductResource::make($producto->load([
|
||||
'attachments',
|
||||
'brand',
|
||||
'category',
|
||||
'variants.definitions.attribute',
|
||||
'variants.attachments',
|
||||
]));
|
||||
}
|
||||
|
||||
public function update(UpdateProductRequest $request, Tenant $tenant, Product $producto, ProductService $productService): ProductResource
|
||||
|
||||
Reference in New Issue
Block a user