feat: add brand and category relationships to products, update requests and resources, and seed product catalog from images

This commit is contained in:
2026-06-29 13:47:05 -03:00
parent 49771ebb13
commit 24235c5ca9
28 changed files with 454 additions and 14 deletions

View File

@@ -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