From 177ba193de4b7e417016e219370a744d7f4de7a8 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Thu, 19 Sep 2024 20:58:44 -0300 Subject: [PATCH] Agregado "requiere notas" a productos con 'PTC' --- app/Http/Resources/ProductoResource.php | 3 +- .../2024_09_17_234635_notas_producto.php | 2 -- ...4_09_19_230732_producto_requiere_notas.php | 32 +++++++++++++++++++ database/seeds/CanastaSeeder.php | 3 +- 4 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 database/migrations/2024_09_19_230732_producto_requiere_notas.php diff --git a/app/Http/Resources/ProductoResource.php b/app/Http/Resources/ProductoResource.php index 5177696..4040989 100644 --- a/app/Http/Resources/ProductoResource.php +++ b/app/Http/Resources/ProductoResource.php @@ -25,7 +25,8 @@ class ProductoResource extends JsonResource 'imagen' => optional($this->poster)->url(), 'descripcion' => $this->descripcion, 'apto_veganxs' => $this->apto_veganxs, - 'apto_celiacxs' => $this->apto_celiacxs + 'apto_celiacxs' => $this->apto_celiacxs, + 'requiere_notas' => $this->requiere_notas, ]; } } diff --git a/database/migrations/2024_09_17_234635_notas_producto.php b/database/migrations/2024_09_17_234635_notas_producto.php index 8b42c65..56b6ff4 100644 --- a/database/migrations/2024_09_17_234635_notas_producto.php +++ b/database/migrations/2024_09_17_234635_notas_producto.php @@ -15,7 +15,6 @@ class NotasProducto extends Migration { Schema::table('producto_subpedido', function (Blueprint $table) { $table->string('notas'); - $table->boolean('requiere-notas'); }); } @@ -28,7 +27,6 @@ class NotasProducto extends Migration { Schema::table('producto_subpedido', function (Blueprint $table) { $table->dropColumn('notas'); - $table->dropColumn('requiere-notas'); }); } } diff --git a/database/migrations/2024_09_19_230732_producto_requiere_notas.php b/database/migrations/2024_09_19_230732_producto_requiere_notas.php new file mode 100644 index 0000000..065fff4 --- /dev/null +++ b/database/migrations/2024_09_19_230732_producto_requiere_notas.php @@ -0,0 +1,32 @@ +boolean('requiere_notas')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('productos', function (Blueprint $table) { + $table->dropColumn('requiere_notas'); + }); + } +} diff --git a/database/seeds/CanastaSeeder.php b/database/seeds/CanastaSeeder.php index f9a5756..0edc5b5 100644 --- a/database/seeds/CanastaSeeder.php +++ b/database/seeds/CanastaSeeder.php @@ -61,7 +61,8 @@ class CanastaSeeder extends Seeder 'nombre' => trim(str_replace('*', ' ',$registro['Producto'])), 'precio' => $registro['Precio'], 'proveedor_id' => $this->obtenerProveedor($registro['Producto']), - 'bono' => $registro[$this::FILA_HEADER] == "B" + 'bono' => $registro[$this::FILA_HEADER] == "B", + 'requiere_notas'=> $registro[$this::FILA_HEADER] =="PTC", ]; }