feat: implement product and attachment management service with supporting migrations and API controllers
This commit is contained in:
@@ -18,7 +18,11 @@ class ProductController extends Controller
|
||||
public function index(Tenant $tenant): JsonResponse
|
||||
{
|
||||
return ProductResource::collection(
|
||||
Product::query()->where('tenant_codigo', $tenant->codigo)->latest()->paginateFromRequest()
|
||||
Product::query()
|
||||
->where('tenant_codigo', $tenant->codigo)
|
||||
->with('attachments')
|
||||
->latest()
|
||||
->paginateFromRequest()
|
||||
)->response();
|
||||
}
|
||||
|
||||
@@ -33,7 +37,7 @@ class ProductController extends Controller
|
||||
{
|
||||
$producto = $this->resolveScopedProduct($tenant, $producto);
|
||||
|
||||
return ProductResource::make($producto->load('variants.definitions.attribute'));
|
||||
return ProductResource::make($producto->load(['attachments', 'variants.definitions.attribute', 'variants.attachments']));
|
||||
}
|
||||
|
||||
public function update(UpdateProductRequest $request, Tenant $tenant, Product $producto, ProductService $productService): ProductResource
|
||||
|
||||
Reference in New Issue
Block a user