From c27e47bb2d59bd68fcf20d5a9f05304e9480e698 Mon Sep 17 00:00:00 2001 From: nat Date: Mon, 24 Jan 2022 12:17:30 -0300 Subject: [PATCH] =?UTF-8?q?Endpoint=20de=20producto=20y=20productos=20devu?= =?UTF-8?q?elven=20m=C3=A1s=20detalles.=20Agrego=20dos=20barrios.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/ProductoController.php | 2 +- app/Http/Resources/ProductoResource.php | 4 +++- .../migrations/2020_09_23_173620_create_productos_table.php | 2 +- resources/csv/barrios.csv | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/ProductoController.php b/app/Http/Controllers/Api/ProductoController.php index e196fa0..57f27fd 100644 --- a/app/Http/Controllers/Api/ProductoController.php +++ b/app/Http/Controllers/Api/ProductoController.php @@ -30,7 +30,7 @@ class ProductoController extends Controller */ public function show(Producto $producto) { - return $producto; + return new ProductoResource($producto); } } diff --git a/app/Http/Resources/ProductoResource.php b/app/Http/Resources/ProductoResource.php index b0210f3..5177696 100644 --- a/app/Http/Resources/ProductoResource.php +++ b/app/Http/Resources/ProductoResource.php @@ -20,10 +20,12 @@ class ProductoResource extends JsonResource 'precio' => $this->precio, 'categoria' => $this->categoria, 'proveedor' => optional($this->proveedor)->nombre, + 'economia_solidaria' => optional($this->proveedor)->economia_solidaria, + 'nacional' => optional($this->proveedor)->nacional, 'imagen' => optional($this->poster)->url(), 'descripcion' => $this->descripcion, 'apto_veganxs' => $this->apto_veganxs, - 'apto_caliacxs' => $this->apto_caliacxs + 'apto_celiacxs' => $this->apto_celiacxs ]; } } diff --git a/database/migrations/2020_09_23_173620_create_productos_table.php b/database/migrations/2020_09_23_173620_create_productos_table.php index 420a077..eac8c87 100644 --- a/database/migrations/2020_09_23_173620_create_productos_table.php +++ b/database/migrations/2020_09_23_173620_create_productos_table.php @@ -24,7 +24,7 @@ class CreateProductosTable extends Migration $table->foreignId('imagen_id')->nullable(); $table->text('descripcion')->nullable(); $table->boolean('apto_veganxs')->nullable(); - $table->boolean('apto_caliacxs')->nullable(); + $table->boolean('apto_celiacxs')->nullable(); $table->timestamps(); }); } diff --git a/resources/csv/barrios.csv b/resources/csv/barrios.csv index 33b9a3d..6d43920 100644 --- a/resources/csv/barrios.csv +++ b/resources/csv/barrios.csv @@ -18,6 +18,7 @@ PEÑAROL|OESTE||| LAS PIEDRAS|OESTE||| A.C.T.E.O|OESTE||| NUEVO PARIS|OESTE||| +SANTA CATALINA|OESTE||| BELVEDERE|OESTE||| BATLLE BERRES|OESTE||| CERRO PTI|OESTE||| @@ -34,6 +35,7 @@ CIUDAD VIEJA|SUR||| COOP EJIDO|SUR||| COVIREUS|SUR||| LA BLANQUEADA|SUR||| +NITEP|SUR||| LA CURVA|SUR||| PANADERIA VIDAL|SUR||| SUA|SUR|||