seeder de barrio con barrio prueba de region prueba

This commit is contained in:
Alejandro Tasistro 2024-03-11 19:09:03 -03:00
parent eba87feb91
commit 2f29b1c34c
2 changed files with 30 additions and 6 deletions

View File

@ -0,0 +1,27 @@
<?php
namespace Database\Seeders;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class BarrioSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('regiones')->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()],
]);
}
}

View File

@ -12,11 +12,8 @@ class DatabaseSeeder extends Seeder
*/ */
public function run(): void public function run(): void
{ {
// \App\Models\User::factory(10)->create(); $this->call([
BarrioSeeder::class,
// \App\Models\User::factory()->create([ ]);
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
} }
} }