ContactInfoFactory.php
1 <?php 2 3 namespace Database\Factories; 4 5 use App\Models\ContactInfo; 6 use App\Models\Country; 7 use Illuminate\Database\Eloquent\Factories\Factory; 8 9 class ContactInfoFactory extends Factory 10 { 11 protected $model = ContactInfo::class; 12 13 public function definition(): array 14 { 15 return [ 16 'address' => $this->faker->address(), 17 'city' => $this->faker->city(), 18 'postal_code' => $this->faker->postcode(), 19 'phone' => $this->faker->phoneNumber(), 20 'email' => $this->faker->unique()->safeEmail(), 21 'country_id' => Country::all()->random()->id, 22 23 ]; 24 } 25 }