From eba87feb91a24f8c14ddd4f07454d9da850e5f8f Mon Sep 17 00:00:00 2001 From: ale Date: Mon, 11 Mar 2024 19:08:31 -0300 Subject: [PATCH 01/26] definiciones y migraciones de region y barrio --- app/Models/Barrio.php | 26 +++++++++++++++ app/Models/Region.php | 33 +++++++++++++++++++ ...2024_03_11_205603_create_regions_table.php | 28 ++++++++++++++++ ...2024_03_11_210402_create_barrios_table.php | 30 +++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 app/Models/Barrio.php create mode 100644 app/Models/Region.php create mode 100644 database/migrations/2024_03_11_205603_create_regions_table.php create mode 100644 database/migrations/2024_03_11_210402_create_barrios_table.php diff --git a/app/Models/Barrio.php b/app/Models/Barrio.php new file mode 100644 index 0000000..02384cc --- /dev/null +++ b/app/Models/Barrio.php @@ -0,0 +1,26 @@ + + */ + protected $fillable = [ + 'name', + ]; + + /** + * La región a la que pertenece el barrio. + */ + public function region(): BelongsTo + { + return $this->belongsTo(Region::class); + } +} diff --git a/app/Models/Region.php b/app/Models/Region.php new file mode 100644 index 0000000..53ddecb --- /dev/null +++ b/app/Models/Region.php @@ -0,0 +1,33 @@ + + */ + protected $fillable = [ + 'name', + ]; + + /** + * Los barrios que pertenecen a la región. + */ + public function barrios(): HasMany + { + return $this->hasMany(Barrio::class); + } +} diff --git a/database/migrations/2024_03_11_205603_create_regions_table.php b/database/migrations/2024_03_11_205603_create_regions_table.php new file mode 100644 index 0000000..ee523be --- /dev/null +++ b/database/migrations/2024_03_11_205603_create_regions_table.php @@ -0,0 +1,28 @@ +id(); + $table->timestamps(); + $table->string('name', 100); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('regiones'); + } +}; diff --git a/database/migrations/2024_03_11_210402_create_barrios_table.php b/database/migrations/2024_03_11_210402_create_barrios_table.php new file mode 100644 index 0000000..4c16a65 --- /dev/null +++ b/database/migrations/2024_03_11_210402_create_barrios_table.php @@ -0,0 +1,30 @@ +id(); + $table->timestamps(); + $table->string('name', 100); + $table->unsignedBigInteger('region_id'); + $table->foreign('region_id')->references('id')->on('regiones'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('barrios'); + } +}; -- 2.44.0 From 2f29b1c34c4020923244268b8acafc7146089762 Mon Sep 17 00:00:00 2001 From: ale Date: Mon, 11 Mar 2024 19:09:03 -0300 Subject: [PATCH 02/26] seeder de barrio con barrio prueba de region prueba --- database/seeders/BarrioSeeder.php | 27 +++++++++++++++++++++++++++ database/seeders/DatabaseSeeder.php | 9 +++------ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 database/seeders/BarrioSeeder.php diff --git a/database/seeders/BarrioSeeder.php b/database/seeders/BarrioSeeder.php new file mode 100644 index 0000000..595f278 --- /dev/null +++ b/database/seeders/BarrioSeeder.php @@ -0,0 +1,27 @@ +insert([ + ['name'=>'PRUEBA', 'created_at'=>Date::now()] + ]); + + $prueba_id = DB::table('regiones')->where('name','PRUEBA')->first()->id; + + DB::table('barrios')->insert([ + ['name'=>'PRUEBA','region_id'=>$prueba_id, 'created_at'=>Date::now()], + ]); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index a9f4519..9e2405c 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -12,11 +12,8 @@ class DatabaseSeeder extends Seeder */ public function run(): void { - // \App\Models\User::factory(10)->create(); - - // \App\Models\User::factory()->create([ - // 'name' => 'Test User', - // 'email' => 'test@example.com', - // ]); + $this->call([ + BarrioSeeder::class, + ]); } } -- 2.44.0 From 2a5cf1ccd99af5f8aac299184d4b4103d7f42440 Mon Sep 17 00:00:00 2001 From: ale Date: Mon, 11 Mar 2024 19:13:06 -0300 Subject: [PATCH 03/26] Cambio orden columnas --- database/migrations/2024_03_11_205603_create_regions_table.php | 2 +- database/migrations/2024_03_11_210402_create_barrios_table.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_03_11_205603_create_regions_table.php b/database/migrations/2024_03_11_205603_create_regions_table.php index ee523be..8417e86 100644 --- a/database/migrations/2024_03_11_205603_create_regions_table.php +++ b/database/migrations/2024_03_11_205603_create_regions_table.php @@ -13,8 +13,8 @@ public function up(): void { Schema::create('regiones', function (Blueprint $table) { $table->id(); - $table->timestamps(); $table->string('name', 100); + $table->timestamps(); }); } diff --git a/database/migrations/2024_03_11_210402_create_barrios_table.php b/database/migrations/2024_03_11_210402_create_barrios_table.php index 4c16a65..8d1352e 100644 --- a/database/migrations/2024_03_11_210402_create_barrios_table.php +++ b/database/migrations/2024_03_11_210402_create_barrios_table.php @@ -13,10 +13,10 @@ public function up(): void { Schema::create('barrios', function (Blueprint $table) { $table->id(); - $table->timestamps(); $table->string('name', 100); $table->unsignedBigInteger('region_id'); $table->foreign('region_id')->references('id')->on('regiones'); + $table->timestamps(); }); } -- 2.44.0 From 12634329bc637fce4434b410064a580dbed4746d Mon Sep 17 00:00:00 2001 From: ale Date: Mon, 11 Mar 2024 19:41:52 -0300 Subject: [PATCH 04/26] definiciones y migraciones de pedido --- app/Models/Barrio.php | 8 +++++ app/Models/Pedido.php | 27 +++++++++++++++++ ...2024_03_11_221942_create_pedidos_table.php | 30 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 app/Models/Pedido.php create mode 100644 database/migrations/2024_03_11_221942_create_pedidos_table.php diff --git a/app/Models/Barrio.php b/app/Models/Barrio.php index 02384cc..9c48da6 100644 --- a/app/Models/Barrio.php +++ b/app/Models/Barrio.php @@ -23,4 +23,12 @@ public function region(): BelongsTo { return $this->belongsTo(Region::class); } + + /** + * Los pedidos que pertenecen al barrio. + */ + public function pedidos(): HasMany + { + return $this->hasMany(Pedido::class); + } } diff --git a/app/Models/Pedido.php b/app/Models/Pedido.php new file mode 100644 index 0000000..957f298 --- /dev/null +++ b/app/Models/Pedido.php @@ -0,0 +1,27 @@ + + */ + protected $fillable = [ + 'name', + ]; + + /** + * El barrio al que pertenece el pedido. + */ + public function barrio(): BelongsTo + { + return $this->belongsTo(Barrio::class); + } + +} diff --git a/database/migrations/2024_03_11_221942_create_pedidos_table.php b/database/migrations/2024_03_11_221942_create_pedidos_table.php new file mode 100644 index 0000000..2848a1b --- /dev/null +++ b/database/migrations/2024_03_11_221942_create_pedidos_table.php @@ -0,0 +1,30 @@ +id(); + $table->string('name', 100); + $table->unsignedBigInteger('barrio_id'); + $table->foreign('barrio_id')->references('id')->on('barrios'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('pedidos'); + } +}; -- 2.44.0 From 983b63897de449c87d0a2b6b25904580d67c4253 Mon Sep 17 00:00:00 2001 From: ale Date: Mon, 11 Mar 2024 19:54:52 -0300 Subject: [PATCH 05/26] definicion y migracion de producto sin nada --- app/Models/Producto.php | 17 ++++++++++++ ...24_03_11_224041_create_productos_table.php | 27 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 app/Models/Producto.php create mode 100644 database/migrations/2024_03_11_224041_create_productos_table.php diff --git a/app/Models/Producto.php b/app/Models/Producto.php new file mode 100644 index 0000000..ee30aac --- /dev/null +++ b/app/Models/Producto.php @@ -0,0 +1,17 @@ +belongsToMany(Pedido::class); + } +} diff --git a/database/migrations/2024_03_11_224041_create_productos_table.php b/database/migrations/2024_03_11_224041_create_productos_table.php new file mode 100644 index 0000000..e524043 --- /dev/null +++ b/database/migrations/2024_03_11_224041_create_productos_table.php @@ -0,0 +1,27 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('productos'); + } +}; -- 2.44.0 From 1129a9e11bf2c05d2198ddc8e0d2a965001425e1 Mon Sep 17 00:00:00 2001 From: ale Date: Mon, 11 Mar 2024 19:55:35 -0300 Subject: [PATCH 06/26] definicion de pedido y migracion de productos_pedidos --- app/Models/Pedido.php | 7 ++++ ..._224437_create_productos_pedidos_table.php | 32 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 database/migrations/2024_03_11_224437_create_productos_pedidos_table.php diff --git a/app/Models/Pedido.php b/app/Models/Pedido.php index 957f298..31bd7be 100644 --- a/app/Models/Pedido.php +++ b/app/Models/Pedido.php @@ -24,4 +24,11 @@ public function barrio(): BelongsTo return $this->belongsTo(Barrio::class); } + /** + * Los productos que pertenecen al pedido. + */ + public function productos(): BelongsToMany + { + return $this->belongsToMany(Producto::class); + } } diff --git a/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php b/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php new file mode 100644 index 0000000..e61e66b --- /dev/null +++ b/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php @@ -0,0 +1,32 @@ +id(); + $table->unsignedBigInteger('pedido_id'); + $table->unsignedBigInteger('producto_id'); + $table->unsignedInteger('ammount'); + $table->timestamps(); + $table->foreign('pedido_id')->references('id')->on('pedidos'); + $table->foreign('producto_id')->references('id')->on('productos'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('productos_pedidos'); + } +}; -- 2.44.0 From 9b53d3f492779255a3fcf924b5909a69c0810acc Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:04:43 -0300 Subject: [PATCH 07/26] typo --- ...ions_table.php => 2024_03_11_205603_create_regiones_table.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename database/migrations/{2024_03_11_205603_create_regions_table.php => 2024_03_11_205603_create_regiones_table.php} (100%) diff --git a/database/migrations/2024_03_11_205603_create_regions_table.php b/database/migrations/2024_03_11_205603_create_regiones_table.php similarity index 100% rename from database/migrations/2024_03_11_205603_create_regions_table.php rename to database/migrations/2024_03_11_205603_create_regiones_table.php -- 2.44.0 From ed1cc787c25a3ea2d6971add24b75469ce9cce97 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:04:59 -0300 Subject: [PATCH 08/26] =?UTF-8?q?modelo=20y=20migracion=20de=20categor?= =?UTF-8?q?=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Categoria.php | 26 +++++++++++++++++ ...4_03_12_195353_create_categorias_table.php | 28 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 app/Models/Categoria.php create mode 100644 database/migrations/2024_03_12_195353_create_categorias_table.php diff --git a/app/Models/Categoria.php b/app/Models/Categoria.php new file mode 100644 index 0000000..66993d1 --- /dev/null +++ b/app/Models/Categoria.php @@ -0,0 +1,26 @@ + + */ + protected $fillable = [ + 'name', + ]; + + /** + * Los productos que pertenecen a la categoría. + */ + public function productos(): HasMany + { + return $this->hasMany(Producto::class); + } +} diff --git a/database/migrations/2024_03_12_195353_create_categorias_table.php b/database/migrations/2024_03_12_195353_create_categorias_table.php new file mode 100644 index 0000000..f67f14c --- /dev/null +++ b/database/migrations/2024_03_12_195353_create_categorias_table.php @@ -0,0 +1,28 @@ +id(); + $table->string('name', 100); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('categorias'); + } +}; -- 2.44.0 From 2e62fcb8652ae9df67170a848d5fc4afd7d1f78f Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:05:15 -0300 Subject: [PATCH 09/26] =?UTF-8?q?relaci=C3=B3n=20producto=20-=20categor?= =?UTF-8?q?=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Producto.php | 8 ++++++ ...2_195543_add_categoria_id_to_productos.php | 28 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 database/migrations/2024_03_12_195543_add_categoria_id_to_productos.php diff --git a/app/Models/Producto.php b/app/Models/Producto.php index ee30aac..8695a73 100644 --- a/app/Models/Producto.php +++ b/app/Models/Producto.php @@ -7,6 +7,14 @@ class Producto extends Model { + /** + * La categoría a la que pertenece el producto. + */ + public function categoria(): BelongsTo + { + return $this->belongsTo(Categoria::class); + } + /** * Los pedidos que tienen al producto. */ diff --git a/database/migrations/2024_03_12_195543_add_categoria_id_to_productos.php b/database/migrations/2024_03_12_195543_add_categoria_id_to_productos.php new file mode 100644 index 0000000..6b5d249 --- /dev/null +++ b/database/migrations/2024_03_12_195543_add_categoria_id_to_productos.php @@ -0,0 +1,28 @@ +unsignedBigInteger('categoria_id')->after('id'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('productos', function (Blueprint $table) { + $table->dropColumn('categoria_id'); + }); + } +}; -- 2.44.0 From 99431bc64fe67deb83e639c8e4568a800bbd32da Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:17:42 -0300 Subject: [PATCH 10/26] =?UTF-8?q?definici=C3=B3n=20y=20migraci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Caracteristica.php | 17 +++++++++++ ...12_201127_create_caracteristicas_table.php | 28 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 app/Models/Caracteristica.php create mode 100644 database/migrations/2024_03_12_201127_create_caracteristicas_table.php diff --git a/app/Models/Caracteristica.php b/app/Models/Caracteristica.php new file mode 100644 index 0000000..d978baa --- /dev/null +++ b/app/Models/Caracteristica.php @@ -0,0 +1,17 @@ +belongsToMany(Producto::class); + } +} diff --git a/database/migrations/2024_03_12_201127_create_caracteristicas_table.php b/database/migrations/2024_03_12_201127_create_caracteristicas_table.php new file mode 100644 index 0000000..c12f53e --- /dev/null +++ b/database/migrations/2024_03_12_201127_create_caracteristicas_table.php @@ -0,0 +1,28 @@ +id(); + $table->string('name', 100); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('caracteristicas'); + } +}; -- 2.44.0 From 2b7a5e1d91d7b826b713102fc8a94a9fe534cb1c Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:18:00 -0300 Subject: [PATCH 11/26] =?UTF-8?q?relaci=C3=B3n=20manyToMany=20producto=20-?= =?UTF-8?q?=20categor=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Producto.php | 8 +++++ ...create_productos_caracteristicas_table.php | 31 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php diff --git a/app/Models/Producto.php b/app/Models/Producto.php index 8695a73..04f935e 100644 --- a/app/Models/Producto.php +++ b/app/Models/Producto.php @@ -22,4 +22,12 @@ public function pedidos(): BelongsToMany { return $this->belongsToMany(Pedido::class); } + + /** + * Las caracteristicas que pertenecen al producto. + */ + public function caracteristicas(): BelongsToMany + { + return $this->belongsToMany(Caracteristica::class); + } } diff --git a/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php b/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php new file mode 100644 index 0000000..4e6a45e --- /dev/null +++ b/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php @@ -0,0 +1,31 @@ +id(); + $table->unsignedBigInteger('producto_id'); + $table->unsignedBigInteger('caracteristica_id'); + $table->timestamps(); + $table->foreign('producto_id')->references('id')->on('productos'); + $table->foreign('caracteristica_id')->references('id')->on('caracteristicas'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('productos_caracteristicas'); + } +}; -- 2.44.0 From 49c0a29e95363c3d142649b3d74fec209784f091 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:26:33 -0300 Subject: [PATCH 12/26] caracteristica seeder --- database/seeders/CaracteristicaSeeder.php | 24 +++++++++++++++++++++++ database/seeders/DatabaseSeeder.php | 1 + 2 files changed, 25 insertions(+) create mode 100644 database/seeders/CaracteristicaSeeder.php diff --git a/database/seeders/CaracteristicaSeeder.php b/database/seeders/CaracteristicaSeeder.php new file mode 100644 index 0000000..192e412 --- /dev/null +++ b/database/seeders/CaracteristicaSeeder.php @@ -0,0 +1,24 @@ +insert([ + ['name'=>'SIN GLUTEN', 'created_at'=>Date::now()], + ['name'=>'SIN SAL AGREGADA', 'created_at'=>Date::now()], + ['name'=>'SIN AZÚCAR AGREGADA', 'created_at'=>Date::now()], + ['name'=>'SIN PRODUCTOS DE ORIGEN ANIMAL', 'created_at'=>Date::now()], + ]); + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 9e2405c..3e7edf8 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -14,6 +14,7 @@ public function run(): void { $this->call([ BarrioSeeder::class, + CaracteristicaSeeder::class, ]); } } -- 2.44.0 From 3635e29cf402b6a2dfe53642136d020fc3de6dc5 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:26:47 -0300 Subject: [PATCH 13/26] cambio a clave primaria compuesta --- .../2024_03_11_224437_create_productos_pedidos_table.php | 2 +- ...2024_03_12_201211_create_productos_caracteristicas_table.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php b/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php index e61e66b..51f50a9 100644 --- a/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php +++ b/database/migrations/2024_03_11_224437_create_productos_pedidos_table.php @@ -12,11 +12,11 @@ public function up(): void { Schema::create('productos_pedidos', function (Blueprint $table) { - $table->id(); $table->unsignedBigInteger('pedido_id'); $table->unsignedBigInteger('producto_id'); $table->unsignedInteger('ammount'); $table->timestamps(); + $table->primary(['pedido_id','producto_id']); $table->foreign('pedido_id')->references('id')->on('pedidos'); $table->foreign('producto_id')->references('id')->on('productos'); }); diff --git a/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php b/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php index 4e6a45e..d07eb3f 100644 --- a/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php +++ b/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php @@ -12,10 +12,10 @@ public function up(): void { Schema::create('productos_caracteristicas', function (Blueprint $table) { - $table->id(); $table->unsignedBigInteger('producto_id'); $table->unsignedBigInteger('caracteristica_id'); $table->timestamps(); + $table->primary(['producto_id','caracteristica_id']); $table->foreign('producto_id')->references('id')->on('productos'); $table->foreign('caracteristica_id')->references('id')->on('caracteristicas'); }); -- 2.44.0 From 4b77fd9b36d2a19450d3b65106664055dea7f3a7 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:40:51 -0300 Subject: [PATCH 14/26] canchullo con las migraciones --- ...as_table.php => 2024_03_11_223553_create_categorias_table.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename database/migrations/{2024_03_12_195353_create_categorias_table.php => 2024_03_11_223553_create_categorias_table.php} (100%) diff --git a/database/migrations/2024_03_12_195353_create_categorias_table.php b/database/migrations/2024_03_11_223553_create_categorias_table.php similarity index 100% rename from database/migrations/2024_03_12_195353_create_categorias_table.php rename to database/migrations/2024_03_11_223553_create_categorias_table.php -- 2.44.0 From bda994bc69aa053f07b5558594459383faf645e7 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:43:43 -0300 Subject: [PATCH 15/26] foreign para abajo del todo --- database/migrations/2024_03_11_210402_create_barrios_table.php | 2 +- database/migrations/2024_03_11_221942_create_pedidos_table.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_03_11_210402_create_barrios_table.php b/database/migrations/2024_03_11_210402_create_barrios_table.php index 8d1352e..ea8018e 100644 --- a/database/migrations/2024_03_11_210402_create_barrios_table.php +++ b/database/migrations/2024_03_11_210402_create_barrios_table.php @@ -15,8 +15,8 @@ public function up(): void $table->id(); $table->string('name', 100); $table->unsignedBigInteger('region_id'); - $table->foreign('region_id')->references('id')->on('regiones'); $table->timestamps(); + $table->foreign('region_id')->references('id')->on('regiones'); }); } diff --git a/database/migrations/2024_03_11_221942_create_pedidos_table.php b/database/migrations/2024_03_11_221942_create_pedidos_table.php index 2848a1b..791a1a8 100644 --- a/database/migrations/2024_03_11_221942_create_pedidos_table.php +++ b/database/migrations/2024_03_11_221942_create_pedidos_table.php @@ -15,8 +15,8 @@ public function up(): void $table->id(); $table->string('name', 100); $table->unsignedBigInteger('barrio_id'); - $table->foreign('barrio_id')->references('id')->on('barrios'); $table->timestamps(); + $table->foreign('barrio_id')->references('id')->on('barrios'); }); } -- 2.44.0 From 908ee6a496a08dcd2932dfef9502a0e4abb4e3b9 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:52:52 -0300 Subject: [PATCH 16/26] nuevos atributos --- app/Models/Producto.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Models/Producto.php b/app/Models/Producto.php index 04f935e..64a047a 100644 --- a/app/Models/Producto.php +++ b/app/Models/Producto.php @@ -7,6 +7,15 @@ class Producto extends Model { + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + 'name', 'price', 'solidario', 'bono' + ]; + /** * La categoría a la que pertenece el producto. */ -- 2.44.0 From b4c9c5b14e8547fa5e841b1fbe6cf659f8eb1e14 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 17:53:06 -0300 Subject: [PATCH 17/26] chanchullo de atributos --- ...24_03_11_224041_create_productos_table.php | 6 ++++ ...2_195543_add_categoria_id_to_productos.php | 28 ------------------- 2 files changed, 6 insertions(+), 28 deletions(-) delete mode 100644 database/migrations/2024_03_12_195543_add_categoria_id_to_productos.php diff --git a/database/migrations/2024_03_11_224041_create_productos_table.php b/database/migrations/2024_03_11_224041_create_productos_table.php index e524043..9449563 100644 --- a/database/migrations/2024_03_11_224041_create_productos_table.php +++ b/database/migrations/2024_03_11_224041_create_productos_table.php @@ -13,7 +13,13 @@ public function up(): void { Schema::create('productos', function (Blueprint $table) { $table->id(); + $table->string('name', 100); + $table->double('price', 15, 2); + $table->unsignedBigInteger('categoria_id'); + $table->boolean('solidario'); + $table->boolean('bono'); $table->timestamps(); + $table->foreign('categoria_id')->references('id')->on('categorias'); }); } diff --git a/database/migrations/2024_03_12_195543_add_categoria_id_to_productos.php b/database/migrations/2024_03_12_195543_add_categoria_id_to_productos.php deleted file mode 100644 index 6b5d249..0000000 --- a/database/migrations/2024_03_12_195543_add_categoria_id_to_productos.php +++ /dev/null @@ -1,28 +0,0 @@ -unsignedBigInteger('categoria_id')->after('id'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::table('productos', function (Blueprint $table) { - $table->dropColumn('categoria_id'); - }); - } -}; -- 2.44.0 From 888a1f4adff14c0910423d0d67f97c296b3a6215 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 22:26:52 -0300 Subject: [PATCH 18/26] cambio en columna --- .../migrations/2024_03_11_224041_create_productos_table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2024_03_11_224041_create_productos_table.php b/database/migrations/2024_03_11_224041_create_productos_table.php index 9449563..139a9a6 100644 --- a/database/migrations/2024_03_11_224041_create_productos_table.php +++ b/database/migrations/2024_03_11_224041_create_productos_table.php @@ -13,7 +13,7 @@ public function up(): void { Schema::create('productos', function (Blueprint $table) { $table->id(); - $table->string('name', 100); + $table->string('name', 200); $table->double('price', 15, 2); $table->unsignedBigInteger('categoria_id'); $table->boolean('solidario'); -- 2.44.0 From c18f745fab8564c6fa9b2fa813800f32e42263d2 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 22:27:02 -0300 Subject: [PATCH 19/26] =?UTF-8?q?columna=20para=20abreviaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2024_03_12_201127_create_caracteristicas_table.php | 1 + 1 file changed, 1 insertion(+) diff --git a/database/migrations/2024_03_12_201127_create_caracteristicas_table.php b/database/migrations/2024_03_12_201127_create_caracteristicas_table.php index c12f53e..5c15851 100644 --- a/database/migrations/2024_03_12_201127_create_caracteristicas_table.php +++ b/database/migrations/2024_03_12_201127_create_caracteristicas_table.php @@ -14,6 +14,7 @@ public function up(): void Schema::create('caracteristicas', function (Blueprint $table) { $table->id(); $table->string('name', 100); + $table->string('key', 100); $table->timestamps(); }); } -- 2.44.0 From 9fbfcf9e0a9a41e65931203c3d0010a6cd96a328 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 22:27:22 -0300 Subject: [PATCH 20/26] campos rellenables --- app/Models/Producto.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Producto.php b/app/Models/Producto.php index 64a047a..6c3e62d 100644 --- a/app/Models/Producto.php +++ b/app/Models/Producto.php @@ -13,7 +13,7 @@ class Producto extends Model * @var array */ protected $fillable = [ - 'name', 'price', 'solidario', 'bono' + 'name', 'price', 'solidario', 'bono', 'categoria_id' ]; /** -- 2.44.0 From 5391f15a1b7427921c06a8aea287cc757938f32e Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 22:27:38 -0300 Subject: [PATCH 21/26] =?UTF-8?q?abreviaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/seeders/CaracteristicaSeeder.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/database/seeders/CaracteristicaSeeder.php b/database/seeders/CaracteristicaSeeder.php index 192e412..c4a517a 100644 --- a/database/seeders/CaracteristicaSeeder.php +++ b/database/seeders/CaracteristicaSeeder.php @@ -15,10 +15,10 @@ class CaracteristicaSeeder extends Seeder public function run(): void { DB::table('caracteristicas')->insert([ - ['name'=>'SIN GLUTEN', 'created_at'=>Date::now()], - ['name'=>'SIN SAL AGREGADA', 'created_at'=>Date::now()], - ['name'=>'SIN AZÚCAR AGREGADA', 'created_at'=>Date::now()], - ['name'=>'SIN PRODUCTOS DE ORIGEN ANIMAL', 'created_at'=>Date::now()], + ['name' => 'SIN GLUTEN', 'key' => 'S-G', 'created_at' => Date::now()], + ['name' => 'SIN SAL AGREGADA', 'key' => 'S-S', 'created_at' => Date::now()], + ['name' => 'SIN AZÚCAR AGREGADA', 'key' => 'S-A', 'created_at' => Date::now()], + ['name' => 'SIN PRODUCTOS DE ORIGEN ANIMAL', 'key' => 'S-P-A', 'created_at' => Date::now()], ]); } } -- 2.44.0 From 3e44e8ee1c73a7e1cbcda33157a75d5b8ce0e55c Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 22:28:01 -0300 Subject: [PATCH 22/26] csv --- composer.json | 1 + composer.lock | 93 ++++++++- resources/csv/productos.csv | 391 ++++++++++++++++++++++++++++++++++++ 3 files changed, 483 insertions(+), 2 deletions(-) create mode 100644 resources/csv/productos.csv diff --git a/composer.json b/composer.json index 274c2a8..3ba83fd 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "laravel/jetstream": "^4.2", "laravel/sanctum": "^3.3", "laravel/tinker": "^2.8", + "league/csv": "^9.15", "livewire/livewire": "^3.0", "tightenco/ziggy": "^1.0" }, diff --git a/composer.lock b/composer.lock index 4556776..1ce6e31 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "16e96cef20b5980f6d570c837fc8710a", + "content-hash": "8d183499e584f55de945d0a59ab769e7", "packages": [ { "name": "bacon/bacon-qr-code", @@ -1997,6 +1997,95 @@ ], "time": "2022-12-11T20:36:23+00:00" }, + { + "name": "league/csv", + "version": "9.15.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/csv.git", + "reference": "fa7e2441c0bc9b2360f4314fd6c954f7ff40d435" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/fa7e2441c0bc9b2360f4314fd6c954f7ff40d435", + "reference": "fa7e2441c0bc9b2360f4314fd6c954f7ff40d435", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-json": "*", + "ext-mbstring": "*", + "php": "^8.1.2" + }, + "require-dev": { + "doctrine/collections": "^2.1.4", + "ext-dom": "*", + "ext-xdebug": "*", + "friendsofphp/php-cs-fixer": "^v3.22.0", + "phpbench/phpbench": "^1.2.15", + "phpstan/phpstan": "^1.10.57", + "phpstan/phpstan-deprecation-rules": "^1.1.4", + "phpstan/phpstan-phpunit": "^1.3.15", + "phpstan/phpstan-strict-rules": "^1.5.2", + "phpunit/phpunit": "^10.5.9", + "symfony/var-dumper": "^6.4.2" + }, + "suggest": { + "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", + "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "League\\Csv\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://github.com/nyamsprod/", + "role": "Developer" + } + ], + "description": "CSV data manipulation made easy in PHP", + "homepage": "https://csv.thephpleague.com", + "keywords": [ + "convert", + "csv", + "export", + "filter", + "import", + "read", + "transform", + "write" + ], + "support": { + "docs": "https://csv.thephpleague.com", + "issues": "https://github.com/thephpleague/csv/issues", + "rss": "https://github.com/thephpleague/csv/releases.atom", + "source": "https://github.com/thephpleague/csv" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2024-02-20T20:00:00+00:00" + }, { "name": "league/flysystem", "version": "3.24.0", @@ -8757,5 +8846,5 @@ "php": "^8.1" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.6.0" } diff --git a/resources/csv/productos.csv b/resources/csv/productos.csv new file mode 100644 index 0000000..d6c5ea4 --- /dev/null +++ b/resources/csv/productos.csv @@ -0,0 +1,391 @@ +Tipo|Producto|Precio +ALIMENTOS NO PERECEDEROS|| +P|Yerba Compuesta La Herboristería 1kg|157.63 +P|Yerba Yusa tradicional 1kg|126.70 +P|Yerba Yusa tradicional 500grs|67.60 +P|Yerba Sara tradicional 1kg (Sin TACC)|137.90 +P|Yerba Sara suave 1kg (Sin TACC)|137.90 +P|*Harina Santa Unión 000 1kg|34.37 +P|*Harina Santa Unión 0000 1kg|39.50 +P|*Harina de arroz Pasaná 1 kg (Puede contener gluten)|65.00 +P|*Harina de Garbanzos Pasaná 1 kg (Puede contener gluten)|140.00 +P|*Mezcla para faina Pasaná 1 kg (Puede contener gluten)|150.00 +P|*Fécula de Mandioca Pasaná 1 kg (Puede contener gluten)|100.00 +P|Fécula de Mandioca 800g (Sin TACC)|105.00 +P|Tres Harinas 500grs (Sin TAAC)|101.00 +P|*Harina Santa Unión 000 Bolsa 25kg|553.79 +P|*Polenta Santa Unión 450gr|16.20 +P|*Mezcla de Fainá Santa Unión 5kg|396.16 +P|"*Harina de trigo intergal orgánica ""La linda sauceña"""|97.00 +P|*Fideos Caorsi Tirabuzón 1kg|70.00 +P|*Fideos Caorsi Tallarín 1kg|78.00 +P|*Fideos Caorsi Moñita 1kg|78.00 +P|*Fideos Caorsi Tirabuzón 5kg|343.00 +P|Arroz Blue Patna 1kg|41.86 +P|Arroz Shiva 1kg|29.15 +P|*Arroz integral 1kg|60.00 +P|*Arroz integral 3kg|170.00 +P|Aceite Condesa de Soja 900 cc.|60.50 +P|Aceite Uruguay de Girasol 900 cc.|85.90 +P|Aceite Optimo canola 900 cc.|70.00 +P|*Aceite de oliva 500 ml.|260.00 +P|Vinagre Uruguay 900ml|57.80 +P|Aceite de Oliva Cuatro Piedras 3 lt|1250.00 +P|*Salsa de soja La Posta 250 ml.|100.00 +P|*Aceitunas verdes sin carozo en frasco La Posta 500 gr.|195.00 +P|*Aceitunas negras sin carozo en frasco La Posta 500 gr.|225.00 +P|Lata de atún Golden Fish desmenuzado al aceite 170g|34.75 +P|Lata de arvejas Campero 300g|18.23 +P|Lata de choclo Cosecha 300g|24.90 +P|Lata de jardinera Cosecha|33.31 +P|Lata de porotos negros Cosecha|34.30 +P|Lata de porotos de frutilla Cosecha|34.30 +P|Lata de duraznos en almíbar Campero|64.40 +P|Mayonesa Uruguay 500g|72.90 +P|Azúcar Bella Unión 1kg|53.50 +P|Azúcar rubia Mascabo 500g|99.00 +P|Azúcar impalpable Hornex 200 gr|39.00 +P|Azúcar impalpable Hornex 1kg|129.00 +P|Almidón de maíz Hornex 1Kg|83.00 +P|Almidón de maíz Ilu wayra 3Kg|200.00 +P|Almidón de maíz Ilu wayra 1Kg|70.00 +P|Almidón de maíz Ilu wayra 500 g|40.00 +P|Polvo de Hornear Hornex 1 kg|151.00 +P|Polvo de Hornear Hornex 100 g + 20 g|38.00 +P|*Esencia de vainilla La Posta 100ml|90.00 +P|*Bicarbonato de sodio La Posta 250 gr|50.00 +P|Grasa Uruguay 400grs|52.30 +P|Levadura seca Hornex 125g|120.00 +P|Café Sorocabana glaseado p/máquina 500 grs|383.36 +P|Café Sorocabana natural p/máquina 500 grs|519.91 +P|Café soluble Saint bollón 170 gr|230.00 +P|Té Negro en hebras 90gr hornimans|39.16 +P|Galletas de arroz SIN SAL Natural Rice 120 gr.|38.00 +P|Galletas de arroz comunes Natural Rice 120 gr|38.00 +P|Leche en polvo entera 250 g|98.00 +P|Leche en polvo entera 1kg|298.00 +P|* Coco rallado 200gr|60.00 +P|* Coco rallado 1kg|210.00 +P|Cocoa Hornex 200gr|51.00 +P|Postre de chocolate Hornex 8 porciones|44.00 +P|Postre LIGHT de vainilla Hornex 8 porciones (aprobado por ADU)|68.00 +P|Flan de vainilla Hornex 8 porciones|44.00 +P|Gelatina de frutilla Hornex 8 porciones|44.00 +P|Bizcochuelo de vainilla SIN GLUTEN 500gr Hornex|170.00 +P|Pizza SIN GLUTEN 320gr Hornex|163.00 +P|Pulpa de Tomate De Ley 1lt (S-G)|48.50 +P|Pure de papa instantaneo De Ley 125g|24.73 +P|*Sal fina sin fluor Polenteados 500g|36.00 +P|*Sal gruesa sin fluor Polenteados 500g|36.00 +P|*Sal Rosa 250gr |76.00 +P|*Salsa de tomate casera (puro tomate) 1 lt - (S-G) - azucar agregada: 1g/L - sal agregada: 0,25g/L|85.00 +P|*Barras de cereales (maní, sésamo, lino, girasol, avena, copos de arroz, copos de máiz, azúcar rubia y miel) - Pack x2|80.00 +P|*Barras de cereales bañadas en chocolate (maní, sésamo, lino, girasol, avena, copos de arroz, copos de máiz, azúcar rubia y miel) - Pack x2|90.00 +P|*Granola artesanal 500 gr Ing: copos ,avena,miel, vainilla,coco rallado, chia,girasol,sésamo, lino,maní, almendras, castañas de caju, nueces, chips de chocolate.|250.00 +P|*Granola simple (avena+ girasol+ pasaUva) 1kg|160.00 +P|*Copos de maíz azucarados 500g|107.00 +P|*Copos de maíz naturales 500g|107.00 +P|*Galletas veganas |210.00 +P|*Crema untable de maní 330 gr, envase de vidrio |210.00 +P|Alfajor de chocolate negro 80 g (S-G) |44.00 +P|Galletitas dulces de naranja y avena 150 g (S-G, S-A, S-P-A)|108.00 +P|Crackers saladas de sésamo girasol y chía 180 g (S-G)|108.00 +P|*Lino 1/4 kg|35.00 +P|*Chía 1/4 kg|70.00 +P|*Girasol 1/2 kg|95.00 +P|*Sésamo 1/4 kg|60.00 +P|*Quinoa 1 kg|200.00 +P|*Dátiles con carozo 500 gr|195.00 +P|*Cacao en polvo 250 grs (S-A)|95.00 +P|*Almendra pelada (sin tostar) Polenteados 100g|89.00 +P|*Pasas de Uva Polenteados 250 gr|79.00 +P|*Nueces Polenteados 100g|89.00 +P|*Castañas tostadas SIN sal 100grs|73.00 +P|*Avena laminada instantánea Polenteados 500g|59.00 +P|*Pan de molde Gory Lacteado 550g|64.00 +P|*Pan de molde Integral Gory 550g|64.00 +P|*Galleta Malteada La Socialista 350g|84.00 +P|*Galleta Malteada c/semillas (sésamo, chia, lino) La Socialista 380gr|103.00 +P|*Galleta Cara Sucia La Socialista 350g|92.00 +P|*Grisines La Socialista 350g|96.00 +P|*Maní pelado frito y salado Polenteados 500g|98.00 +P|*Maní pelado sin sal Polenteados 500g|98.00 +P|*Garbanzo Polenteados 1kg|96.00 +P|* Maiz para pop 500grs|54.00 +P|*Lentejas Polenteados 1kg|119.00 +P|*Porotos negros Polenteados 1kg|98.00 +P|*Porotos de manteca Polenteados 1kg|126.00 +P|*Proteína de SOJA texturizada 1kg|130.00 +P|*Semillas Zapallo 100g.|55.00 +CONDIMENTOS, PERECEDEROS Y BEBIDAS|| +P|*Tallarines frescos de yema Pastas Colon 1kg|175.00 +P|*Tallarines frescos de espinaca Pastas Colon 1kg|185.00 +P|*Tallarines frescos de morrón Pastas Colon 1kg|190.00 +P|*Salsa pomarola 300gr ex trabajadores de La Spezia|90.00 +P|*Romanitos rellenos jamón y queso ex trabajadores de La Spezia 1kg|530.00 +P|*Romanitos vegetarianos ex trabajadores de La Spezia 1kg|530.00 +P|*Sorrentinos jamón y queso 1Kg ex trabajadores de La Spezia|495.00 +P|*Sorrentinos Ricota y Nuez 1kg ex Trabajadores de La Spezia|495.00 +P|*Raviolón vegetariano 1Kg ex trabajadores de La Spezia|480.00 +P|*Raviolón Caprese 1kg ex Trabajadores de La Spezia|480.00 +P|*Milanesas de carne empanadas 1kg|375.00 +P|*Milanesas de pollo empanadas 1kg|365.00 +P|*Empanada de pollo x 6|260.00 +P|*Empanada de carne x 6|260.00 +P|*Milanesas de seitan x6|350.00 +P|*Queso de mandioca en horma 400 gr|250.00 +P|*Dulce de leche de coco 360 gr|350.00 +P|*Hamburguesas parrilleras de soja no transgénica, sal, harina de avena y adobo sin picante x6 - (S-A)|360.00 +P|*Asado de tira (Proteína de trigo,avena,adobo sin picante,pulpa de tomate,levadura,color caramelo) 400 g - (S-A) |250.00 +P|*Pan rallado 1kg|65.00 +P|*Pan rallado saborizado 1Kg|85.00 +P|*Pimienta blanca 30g|20.00 +P|*Orégano 25g|20.00 +P|*Pimentón 30g|20.00 +P|*Adobo 30g|20.00 +P|*Ajo y Perejil 30g|20.00 +P|*Clavo de olor 15g|20.00 +P|*Tomillo 25g|20.00 +P|"*PACK ""A"" Curry / Nuez moscada / Ajo en polvo / Condimento verde / Comino"|100.00 +P|"*PACK ""B"" Pimienta Negra polvo / Sal de ajo / Aji molido / Canela en polvo / Condimento para arroz"|100.00 +P|"*PACK ""C"" Cebolla en polvo / Pimienta blanca en grano / Pimienta negra en grano / Ajo en escamas / Especias surtidas"|100.00 +P|*Pimentón 250grs|110.00 +P|*Orégano 250g|115.00 +P|*Nuez moscada entera 2 unidades|23.00 +P|*Canela en rama 10g|23.00 +P|*Cúrcuma 20g|23.00 +P|"*Pack ""Sabores exóticos""- pimentón español, fenogreco en polvo y mostaza en polvo."|115.00 +P|"*Pack ""Depurante""- Amambaya, sen y epilobio."|115.00 +P|"*Pack ""Relax""- Tilo, te rojo y malva."|115.00 +P|"*Pack ""Pal mate"" - Boldo, cedrón, marcela."|115.00 +P|Atado de perejil|50.00 +P|Mix de hierbas (ciboullete, tomillo, laurel y pasto lim[on)|50.00 +P|Atado de romero|50.00 +P|Fernet 760 ml|390.00 +P|Vino Santero Marselán 1 lt.|220.00 +P|Vino Tannat-Cabernet Paso del Roble 1 lt.|98.00 +P|Vino Rosado dulce Paso del Roble 1 lt.|98.00 +P|Frizzante de Maracuyá|230.00 +P|Frizzante de Frutos del bosque|230.00 +P|*Cerveza artesanal APA Press 1L|150.00 +P|*Cerveza artesanal Negra Press 1L|150.00 +P|Papas Charly 250G con sal|154.00 +P|Papas Charly 250G sin sal|154.00 +P|*Refresco U Naranja 2lt|89.00 +P|*Refresco U Mandarina 2lt|89.00 +P|*Refresco U Pomelo 2lt|89.00 +P|*Refresco U Limonada 2lt|89.00 +P|*Agua 6 lts|94.00 +P|*Queso Muzzarella 1/2 kg Unidad Cooperaria|165.00 +P|*Queso Magro s/sal 1/2 kg Unidad Cooperaria|184.00 +P|*Queso Magro c/sal 1/2 kg Uniddad Cooperaria|184.00 +P|*Queso Danbo 1/2 kg Unidad Cooperaria|180.00 +P|*Queso Sbrinz 1/2 kg Unidad Cooperaria|275.00 +P|*Queso Colonia 1/2 Kg Unidad Cooperaria|189.00 +P|*Queso parrillero 350g Unidad Cooperaria|169.00 +P|*Queso semiduro 500grs (envasado al vacío) Productores Ismael Cortinas|243.00 +P|*Queso cuartirolo horma 1kg envasado al vacío|355.00 +P|*Queso rallado 200grs|145.00 +P|*Dulce de Leche 1 Kg Unidad Cooperaria|258.00 +P|*Morrones en vinagre 330 gr|200.00 +P|*Berenjenas en vinagre 330 gr|200.00 +P|*Mermelada de morrones 250 gr|200.00 +P|*Mermelada de frutilla, 450 grs.|138.50 +P|*Mermelada de durazno, 450 grs.|126.00 +P|*Mermelada de ciruela, 450 grs.|134.00 +P|*Mermelada de higo, 450 grs.|126.00 +P|*Mermelada de zapallo, 450 grs.|132.00 +P|*Mermelada de tomate, 450 grs.|134.00 +P|*Mermelada de arándanos, 450 grs.|159.50 +P|*Dulce de membrillo, 900grs|114.00 +P|*Dulce de batata con chocolate 1kg|146.50 +P|*Dulce de zapallo 1kg|136.00 +P|*Dulce de higo 1kg|128.00 +P|*Miel artesanal 500g|130.00 +P|*Miel artesanal 1 kg|240.00 +P|"*Canasta de frutas y verduras ""34 Sur Productos Orgánicos"""|630.00 +ARTÍCULOS PERSONALES Y DE LIMPIEZA|| +P|Preservativos Prime ultrafinos x3|89.70 +P|Tabaco Cerrito|125.67 +P|Hojilla JOB x30|28.36 +P|Shampoo Suave 930ml|130.00 +P|Acondicionador Suave 930ml|130.00 +P|Jabón de tocador IO, 80gs|15.30 +P|Cepillo dental kolynos máster. |23.00 +P|Pasta Dental kolynos 180 grs. |48.00 +P|Pastillas para mosquitos Fuyi x 12|92.35 +P|*Pack x3 jabones glicerina vegetal Natura|350.00 +P|*Shampoo artesanal pelo seco 250ml Natura|230.00 +P|*Desodorante ecológico apto veganos Natura|175.00 +P|*Shampoo artesanal pelo graso 250ml Natura|235.00 +P|*Barrita quita manchas 75 gr Natura|100.00 +P|*Aromatizador ambiental fragancia floral de varilla Natura, 100ml |330.00 +P|*Aromatizador ambiental fragancia cítrica de varilla Natura, 100ml |330.00 +P|* Repelente 125 ml Natura|260.00 +P|*Talco pédico 200gr|200.00 +P|*Shampoo pediculosis, envase 125ml|320.00 +P|* Shampoo sólido para cabello seco Herencia de Aquelarre 90 gr |390.00 +P|* Shampoo sólido para cabello graso Herencia de Aquelarre 90 gr |390.00 +P|*Acondicionador sólido Herencia de Aquelarre 50 gr |330.00 +P|* Pasta dental Herencias de Aquelarre 65 cc|270.00 +P|*Bálsamo labial Herencias de aquelarre (protege y repara) 15 cc|250.00 +P|* Ungüento expectorante y digestivo 30 cc|380.00 +P|*Jabón en polvo Bonsai 800g|85.00 +P|*Jabón en polvo Bonsai 5kg|420.00 +P|*Suavizante Bonsai 1lt|80.00 +P|*Jabon liquido para lavarropas 900 cc Bonsai|85.00 +P|*Jabon liquido para lavarropas 3 lts Bonsai|270.00 +P|*Jabon liquido de Manos 500 cc Bonsai|60.00 +P|*Perfumador de telas 250 cc Bonsai|120.00 +P|*Limpiador desengarsante para cocinas y baños aroma cítrico 1 litro (no es para cañerías)|120.00 +P|*Entrebichitos - MEN 2lts. (graseras, pozos, cañerías, plantas)|180.00 +P|*Entrebichitos - MEN Limpieza 1lt (suelos, mesadas, paredes, combate hongos, bacterias y virus)|100.00 +P|*Entrebichitos - Pastilla grasera|80.00 +P|*Hipoclorito El Resistente 1800cc|74.00 +P|*Limpiador perfumado El Resistente (perfumol) 1800cc|74.00 +P|*Detergente El Resistente 500ml|49.00 +P|*KIT El Resistente (Hip./Perf./Det.)|182.00 +P|Jabon en barra Primor x1|25.67 +P|Rejilla de cocina 40 x 27.5 Tacuabé (ex Paylana) cm|35.00 +P|Trapo de piso 53 x 53 Tacuabé (ex Paylana)|43.00 +P|Esponja de cocina|26.00 +P|Esponja de acero inoxidable|29.00 +P|Repasador de algodón 43 x 65 cm|53.00 +P|Franela 34 x 34|37.00 +P|Escoba|116.00 +P|Pala con mango|99.00 +P|Balde 9 Lts|109.00 +P|Bolsa de residuos 50x55 30 unidades|63.00 +P|Lampazo|119.00 +P|Rollitos de aluminio Griselda x12|38.30 +P|rollitos de aluminio jaspe x6|30.00 +P|*Vela de apagón|8.40 +P|*Vela de citronela 1 mecha|132.80 +P|Pañales Babysec ULTRA XXG 24 unidades|344.04 +P|Pañales Babysec ULTRA XG 24 unidades|344.04 +P|Pañales Babysec ULTRA G 30 unidades|344.04 +P|Pañales Babysec ULTRA M 36 unidades|344.04 +P|Pañales Babysec ULTRA P 36 unidades|344.04 +P|Toallita de bebé BabySec ultra 50un|79.00 +P|Papel Higienico: Higienol Texturado x4|45.36 +P|Papel de Cocina Sussex extra x 2 -120 paños-|78.84 +P|Pañales para Adultes INCOPROTECT TALLE M|579.00 +P|Pañales para Adultes INCOPROTECT TALLE G |617.00 +P|Pañales para Adultes INCOPROTECT TALLE EXTRA G |743.00 +TEXTIL|| +PTC|*Calza licra de algodon talle S|900.00 +PTC|*Calza licra de algodon talle M|900.00 +PTC|*Calza licra de algodon talle L|900.00 +PTC|*Calza licra de algodon talle XL|900.00 +P|*Conjunto primera muda 100% algodón (pack de pelele, bata y gorrito en bolsa de lienzo) color a elección sujeto a disponibilidad de tela|600.00 +PTC|*Calza licra de algodon talle 0|350.00 +PTC|*Calza licra de algodon talle 2|350.00 +PTC|*Calza licra de algodon talle 4|350.00 +PTC|*Calza licra de algodon talle 6|450.00 +PTC|*Calza licra de algodon talle 8|450.00 +PTC|*Calza licra de algodon talle 10|450.00 +PTC|*Calza licra de algodon talle 12|550.00 +PTC|*Calza licra de algodon talle 14|550.00 +PTC|*Calza licra de algodon talle 16|550.00 +PTC|*Campera deportiva - Talle 0|400.00 +PTC|*Campera deportiva - Talle 2|400.00 +PTC|*Campera deportiva - Talle 4|400.00 +PTC|*Campera deportiva - Talle 6|450.00 +PTC|*Campera deportiva - Talle 8|450.00 +PTC|*Campera deportiva - Talle 10|450.00 +PTC|*Campera deportiva - Talle 12|500.00 +PTC|*Campera deportiva - Talle 14|500.00 +PTC|*Campera deportiva - Talle 16|500.00 +PTC|*Pantalón deportivo - Talle 0|300.00 +PTC|*Pantalón deportivo - Talle 2|300.00 +PTC|*Pantalón deportivo - Talle 4|300.00 +PTC|*Pantalón deportivo - Talle 6|350.00 +PTC|*Pantalón deportivo - Talle 8|350.00 +PTC|*Pantalón deportivo - Talle 10|350.00 +PTC|*Pantalón deportivo - Talle 12|400.00 +PTC|*Pantalón deportivo - Talle 14|400.00 +PTC|*Pantalón deportivo - Talle 16|400.00 +PTC|*Bikers licra de algodón - Talle S.|650.00 +PTC|*Bikers licra de algodón - Talle M. |650.00 +PTC|*Bikers licra de algodón - Talle L.|650.00 +PTC|*Bikers licra de algodón - Talle XL. |650.00 +PTC|*Pantalón deportivo de verano con puño - Talle S. |900.00 +PTC|*Pantalón deportivo de verano con puño - Talle M. |900.00 +PTC|*Pantalón deportivo de verano con puño - Talle L. |900.00 +PTC|*Pantalón deportivo de verano con puño - Talle XL. |900.00 +PTC|*Buzo deportivo de verano - Talle S.|1000.00 +PTC|*Buzo deportivo de verano - Talle M. |1000.00 +PTC|*Buzo deportivo de verano - Talle L.|1000.00 +PTC|*Buzo deportivo de verano - Talle XL.|1000.00 +PTC|*Túnica niñe con cinto en espalda y tajo detrás- talles 6 a 16|700.00 +PTC|*Túnica niñe con martingala, festón y pinzas talles 6 a 16|700.00 +PTC|*Pintor verde - talles 2 a 8|350.00 +PTC|*Pintor azul - talles 2 a 8|350.00 +PTC|*Pintor rojo - talles 2 a 8|350.00 +PTC|*Pintor amarillo - talles 2 a 8|350.00 +PTC|*Túnicas adulto - talles 1 a 5|1200.00 +P|*Moña escolar satinada|70.00 +P|*Juego de sábanas de algodón 1 plaza|1200.00 +P|*Juego de sábanas de algodón 2 plazas (para sommier)|1400.00 +P|*Materas de Lona.|450.00 +P|*Sábana sola con elástico, 2 plazas (para sommier)|850.00 +P|*Juego de toallón y toalla de algodón|800.00 +P|*Toallón|650.00 +P|*Toalla de mano|350.00 +P|*Turbante toalla|450.00 +ARTÍCULOS DE MADRES Y FAMILIARES|| +P|Pañuelo Madres y Familiares de Detenidos Desaparecidos|50.00 +P|Balconera Madres y Familiares de Detenidos Desaparecidos|100.00 +P|Pin redondo|50.00 +P|Lapiceras|30.00 +P|"Libro ""Sal de la tierra"""|50.00 +P|"Libro ""Desaparecidos"""|50.00 +ARTÍCULOS DE LA COORDINADORA POR PALESTINA|| +B|Bono colaboración|20.00 +P|Remera talle S|450.00 +P|Remera talle M|450.00 +P|Remera talle L|450.00 +P|Remera talle XL|450.00 +P|Bandera 60x90 cm|450.00 +P|Pin|50.00 +P|Balconera Palestina|150.00 +P|Kit 5 pegotines|80.00 +PRODUCTOS ESPECIALES|| +P|*Agenda 2024|390.00 +P|*Cuaderno artesanal 80 hojas rayado|100.00 +P|*Cuaderno artesanal 80 hojas liso|100.00 +P|*Cuaderno artesanal 200 hojas rayado|180.00 +P|*Cuaderno artesanal 200 hojas liso|180.00 +P|Boligrafo Trilux Faber-Castell |7.50 +P|Corrector Punta Metalica Faber-Castell |42.90 +P|Cuadernola Papiros Flex 96 hojas |53.90 +P|Lapiz de Escribir Supersoft Glam Faber-Castell |8.60 +P|Goma de Borrar Chica Faber-Castell |14.17 +P|Sacapuntas Rectangular con Deposito |9.90 +P|Cuaderno Papiros Flex 96 hojas |29.50 +P|Cola Blanca 110g Faber-Castell |35.50 +P|Promo Lapices de Colores x12 Faber-Castell |79.90 +P|Juego de Geometria 30 cm |24.90 +P|Compas Metalico con lápiz y estuche |49.90 +P|Almanaque imán NUEVO!|30.00 +TRANSPORTE, BONOS Y FINANCIAMIENTO SORORO|| +T|Por cada $ 500 de consumo, abonar $ 15 para transporte y gastos operativos, ej:$520 son $30|15.00 +B|Campaña solidaria MPS - apoyo a ollas y merenderos|20.00 +B|Financiamiento sororo para copa menstrual|20.00 +B|Bono especial - Fondo de funcionamiento del MPS|20.00 +PRODUCTOS DE GESTIÓN MENSTRUAL|| +¿Cuántas copas quieren y pueden comprar en el grupo?|| +P|Copa menstrual de silicona, ecológica - talle S|525.00 +P|Copa menstrual de silicona, ecológica - talle M|525.00 +P|Copa menstrual de silicona, ecológica - talle L|525.00 +¿Cuántas copas quieren adquirir a través del financiamiento sororo?|| +P|Copa menstrual de silicona, ecológica - talle S - sorora|0.00 +P|Copa menstrual de silicona, ecológica - talle M - sorora|0.00 +P|Copa menstrual de silicona, ecológica - talle L - sorora|0.00 +P|"*Toallita de tela Nocturna ""Chúlin"""|196.00 +P|"*Toallita de tela para Colaless ""Chúlin"""|168.00 +P|"*Toallitas de tela para Bombacha ""Chúlin"""|168.00 +P|"*Protector Diario de tela ""Chúlin"""|126.00 +P|"*Pack 1: 2 protectores diarios + 2 toallitas para bombacha ""Chúlin"""|546.00 +P|"*Pack 2: 3 protectores diarios ""Chúlin"""|364.00 +P|Ladysoft Clasicas 8un|15.00 -- 2.44.0 From 3a36da60771bbaef14f41fdfdfc66afb14eb1520 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 22:28:22 -0300 Subject: [PATCH 23/26] =?UTF-8?q?logica=20para=20parsear=20productos=20y?= =?UTF-8?q?=20categor=C3=ADas=20de=20csv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/seeders/CanastaSeeder.php | 111 ++++++++++++++++++++++++++++ database/seeders/DatabaseSeeder.php | 3 + 2 files changed, 114 insertions(+) create mode 100644 database/seeders/CanastaSeeder.php diff --git a/database/seeders/CanastaSeeder.php b/database/seeders/CanastaSeeder.php new file mode 100644 index 0000000..2ed5437 --- /dev/null +++ b/database/seeders/CanastaSeeder.php @@ -0,0 +1,111 @@ +setDelimiter('|'); + $csv->setHeaderOffset(0); + $records = $csv->getRecords(); + + $productosToInsert = []; + $caracteristicasToInsert = []; + $currentCategoria; + foreach ($records as $i => $record) { + $tipo = trim($record[$tipoColumn]); + + if (!in_array($tipo, $tipos)) { + if (!Str::contains($tipo,'¿') && ($tipo != 'T')) { + $currentCategoria = Categoria::firstOrCreate(['name' => $tipo]); + } + } else { + $parsed = $this->parseAndFormatName($record[$productoColumn]); + + $productosToInsert[] = [ + 'name' => $parsed['name'], + 'price' => $record[$precioColumn], + 'solidario' => $parsed['solidario'], + 'bono' => $tipo == 'B', + 'categoria_id' => $currentCategoria->id + ]; + + $caracteristicasToInsert[] = [ + 'name' => $parsed['name'], + 'caracteristicas' => $parsed['caracteristicas'] + ]; + } + } + + foreach (array_chunk($productosToInsert,DatabaseSeeder::CHUNK_SIZE) as $chunk) { + DB::table('productos')->insert($chunk); + } + + $this->insertCaracteristicas($caracteristicasToInsert); + } + + /** + * Returns an array data parsed from productoColumn. + * + * @return array{solidario: bool, name: string, caracteristicas: array(Caracteristica)} + */ + private function parseAndFormatName($productoColumn): array { + $solidario = Str::contains($productoColumn, '*'); + $name = Str::replace('*','',$productoColumn); + + $caracteristicas = []; + if (Str::contains($name, 'S-G')) + $caracteristicas[] = Caracteristica::where('key','S-G')->first()->id; + if (Str::contains($name, 'S-A')) + $caracteristicas[] = Caracteristica::where('key','S-A')->first()->id; + if (Str::contains($name, 'S-S')) + $caracteristicas[] = Caracteristica::where('key','S-S')->first()->id; + if (Str::contains($name, 'S-P-A')) + $caracteristicas[] = Caracteristica::where('key','S-P-A')->first()->id; + + if ($caracteristicas) { + $name = Str::replaceMatches('/\(S\-.*\)/', '', $name); + } + + return [ + 'solidario' => $solidario, + 'name' => trim($name), + 'caracteristicas' => $caracteristicas + ]; + } + + private function insertCaracteristicas($caracteristicasToInsert) : void { + foreach ($caracteristicasToInsert as $key => $item) { + $name = $item['name']; + $match = Producto::where('name',$name)->first(); + if ($match) { + foreach ($item['caracteristicas'] as $key => $caracteristica) { + DB::table('productos_caracteristicas')->insert([ + 'producto_id' => $match->id, + 'caracteristica_id' => $caracteristica, + ]); + } + } + } + } +} diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 3e7edf8..a5c2607 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -7,6 +7,8 @@ class DatabaseSeeder extends Seeder { + const CHUNK_SIZE = 10; + /** * Seed the application's database. */ @@ -15,6 +17,7 @@ public function run(): void $this->call([ BarrioSeeder::class, CaracteristicaSeeder::class, + CanastaSeeder::class, ]); } } -- 2.44.0 From f8239a624db23161d5248156d0035d9d52606a8d Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 22:33:04 -0300 Subject: [PATCH 24/26] chunk size --- database/seeders/DatabaseSeeder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index a5c2607..6ea5fea 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -7,7 +7,7 @@ class DatabaseSeeder extends Seeder { - const CHUNK_SIZE = 10; + const CHUNK_SIZE = 100; /** * Seed the application's database. -- 2.44.0 From 5ea06ff003dfafab704552947817d697aa118906 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 23:55:46 -0300 Subject: [PATCH 25/26] timestams innecesarias --- .../2024_03_12_201211_create_productos_caracteristicas_table.php | 1 - 1 file changed, 1 deletion(-) diff --git a/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php b/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php index d07eb3f..e3c71ba 100644 --- a/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php +++ b/database/migrations/2024_03_12_201211_create_productos_caracteristicas_table.php @@ -14,7 +14,6 @@ public function up(): void Schema::create('productos_caracteristicas', function (Blueprint $table) { $table->unsignedBigInteger('producto_id'); $table->unsignedBigInteger('caracteristica_id'); - $table->timestamps(); $table->primary(['producto_id','caracteristica_id']); $table->foreign('producto_id')->references('id')->on('productos'); $table->foreign('caracteristica_id')->references('id')->on('caracteristicas'); -- 2.44.0 From 09a024b69d91f563659784107e61c21a5016bccf Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 12 Mar 2024 23:56:05 -0300 Subject: [PATCH 26/26] seteo de timestamps al insertar --- database/seeders/BarrioSeeder.php | 14 +++++++------- database/seeders/CanastaSeeder.php | 5 ++++- database/seeders/CaracteristicaSeeder.php | 8 ++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/database/seeders/BarrioSeeder.php b/database/seeders/BarrioSeeder.php index 595f278..1d59a25 100644 --- a/database/seeders/BarrioSeeder.php +++ b/database/seeders/BarrioSeeder.php @@ -6,6 +6,8 @@ use Illuminate\Support\Facades\DB; use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; +use App\Models\Region; +use App\Models\Barrio; class BarrioSeeder extends Seeder { @@ -14,14 +16,12 @@ class BarrioSeeder extends Seeder */ public function run(): void { - DB::table('regiones')->insert([ - ['name'=>'PRUEBA', 'created_at'=>Date::now()] - ]); + $prueba_id = Region::create([ + 'name' => 'PRUEBA', + ])->id; - $prueba_id = DB::table('regiones')->where('name','PRUEBA')->first()->id; - - DB::table('barrios')->insert([ - ['name'=>'PRUEBA','region_id'=>$prueba_id, 'created_at'=>Date::now()], + Barrio::create([ + 'name'=>'PRUEBA','region_id'=>$prueba_id, 'created_at'=>Date::now() ]); } } diff --git a/database/seeders/CanastaSeeder.php b/database/seeders/CanastaSeeder.php index 2ed5437..a61c3aa 100644 --- a/database/seeders/CanastaSeeder.php +++ b/database/seeders/CanastaSeeder.php @@ -4,6 +4,7 @@ use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\Date; use Illuminate\Support\Facades\DB; use Illuminate\Support\Arr; use Illuminate\Support\Str; @@ -47,7 +48,9 @@ public function run(): void 'price' => $record[$precioColumn], 'solidario' => $parsed['solidario'], 'bono' => $tipo == 'B', - 'categoria_id' => $currentCategoria->id + 'categoria_id' => $currentCategoria->id, + 'created_at' => Date::now(), + 'updated_at' => Date::now(), ]; $caracteristicasToInsert[] = [ diff --git a/database/seeders/CaracteristicaSeeder.php b/database/seeders/CaracteristicaSeeder.php index c4a517a..1b6bef7 100644 --- a/database/seeders/CaracteristicaSeeder.php +++ b/database/seeders/CaracteristicaSeeder.php @@ -15,10 +15,10 @@ class CaracteristicaSeeder extends Seeder public function run(): void { DB::table('caracteristicas')->insert([ - ['name' => 'SIN GLUTEN', 'key' => 'S-G', 'created_at' => Date::now()], - ['name' => 'SIN SAL AGREGADA', 'key' => 'S-S', 'created_at' => Date::now()], - ['name' => 'SIN AZÚCAR AGREGADA', 'key' => 'S-A', 'created_at' => Date::now()], - ['name' => 'SIN PRODUCTOS DE ORIGEN ANIMAL', 'key' => 'S-P-A', 'created_at' => Date::now()], + ['name' => 'SIN GLUTEN', 'key' => 'S-G', 'created_at' => Date::now(), 'updated_at' => Date::now()], + ['name' => 'SIN SAL AGREGADA', 'key' => 'S-S', 'created_at' => Date::now(), 'updated_at' => Date::now()], + ['name' => 'SIN AZÚCAR AGREGADA', 'key' => 'S-A', 'created_at' => Date::now(), 'updated_at' => Date::now()], + ['name' => 'SIN PRODUCTOS DE ORIGEN ANIMAL', 'key' => 'S-P-A', 'created_at' => Date::now(), 'updated_at' => Date::now()], ]); } } -- 2.44.0