seeder de barrio con barrio prueba de region prueba
This commit is contained in:
parent
eba87feb91
commit
2f29b1c34c
|
@ -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()],
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue