Compare commits

..

2 Commits

3 changed files with 36 additions and 28 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace Database\Seeders;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Region;
use App\Models\Barrio;
use App\Models\Producto;
use App\Models\Categoria;
class BarrioPruebaSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Producto::create([
'name' => 'Bono barrial',
'price' => 20,
'solidario' => false,
'bono' => true,
'categoria_id' => Categoria::firstOrCreate([
'name' => 'TRANSPORTE, BONOS Y FINANCIAMIENTO SORORO'
])->id,
'barrio_id' => Barrio::create([
'name'=>'PRUEBA',
'region_id' => Region::create(['name' => 'PRUEBA'])->id
])->id,
]);
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Support\Facades\Date;
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
{
/**
* Run the database seeds.
*/
public function run(): void
{
$prueba_id = Region::create([
'name' => 'PRUEBA',
])->id;
Barrio::create([
'name'=>'PRUEBA','region_id' => $prueba_id
]);
}
}

View File

@ -15,9 +15,9 @@ class DatabaseSeeder extends Seeder
public function run(): void public function run(): void
{ {
$this->call([ $this->call([
BarrioSeeder::class,
CaracteristicaSeeder::class, CaracteristicaSeeder::class,
CanastaSeeder::class, CanastaSeeder::class,
BarrioPruebaSeeder::class,
]); ]);
} }
} }