28 lines
655 B
PHP
28 lines
655 B
PHP
<?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()],
|
|
]);
|
|
}
|
|
}
|