EntitySeeder.php
1 <?php 2 3 namespace Database\Seeders; 4 5 use App\Enums\EntityTypeEnum; 6 use App\Models\ContactInfo; 7 use App\Models\Entity; 8 use Illuminate\Database\Seeder; 9 10 class EntitySeeder extends Seeder 11 { 12 /** 13 * Run the database seeds. 14 * 15 * @return void 16 */ 17 public function run() 18 { 19 // random 20 $entity = Entity::factory()->create(); 21 ContactInfo::factory()->for($entity, 'contactable')->create(); 22 23 // cab 24 $entity = Entity::factory()->create([ 25 'name' => 'CAB', 26 'entity_type_id' => EntityTypeEnum::cab(), 27 ]); 28 ContactInfo::factory()->for($entity, 'contactable')->create([ 29 'email' => 'cab@sgoc.eu', 30 ]); 31 32 // lab 33 $entity = Entity::factory()->create([ 34 'entity_type_id' => EntityTypeEnum::laboratory(), 35 ]); 36 ContactInfo::factory()->for($entity, 'contactable')->create(); 37 } 38 }