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()], ]); } }