feat: implement product controller, service, and feature tests with updated API collection.
This commit is contained in:
@@ -15,19 +15,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class ProductController extends Controller
|
||||
{
|
||||
public function index(Tenant $tenant): JsonResponse
|
||||
public function index(Tenant $tenant, ProductService $productService): JsonResponse
|
||||
{
|
||||
return ProductResource::collection(
|
||||
Product::query()
|
||||
->where('tenant_codigo', $tenant->codigo)
|
||||
->with([
|
||||
'attachments' => fn ($query) => $query->orderBy('attachments.id')->limit(1),
|
||||
'brand',
|
||||
'category',
|
||||
'attributes.options',
|
||||
])
|
||||
->latest()
|
||||
->paginateFromRequest()
|
||||
$productService->getProductos($tenant)
|
||||
)->response();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user