| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 | 
							- <?php
 - 
 - namespace Database\Factories\Common;
 - 
 - use App\Models\Common\Contact;
 - use Database\Factories\Concerns\HasParentRelationship;
 - use Illuminate\Database\Eloquent\Factories\Factory;
 - 
 - /**
 -  * @extends Factory<Contact>
 -  */
 - class ContactFactory extends Factory
 - {
 -     use HasParentRelationship;
 - 
 -     /**
 -      * The name of the factory's corresponding model.
 -      */
 -     protected $model = Contact::class;
 - 
 -     /**
 -      * Define the model's default state.
 -      *
 -      * @return array<string, mixed>
 -      */
 -     public function definition(): array
 -     {
 -         return [
 -             'company_id' => 1,
 -             'first_name' => $this->faker->firstName,
 -             'last_name' => $this->faker->lastName,
 -             'email' => $this->faker->unique()->safeEmail,
 -             'phones' => $this->generatePhones(),
 -             'is_primary' => $this->faker->boolean(50),
 -             'created_by' => 1,
 -             'updated_by' => 1,
 -         ];
 -     }
 - 
 -     protected function generatePhones(): array
 -     {
 -         $phones = [];
 - 
 -         if ($this->faker->boolean(80)) {
 -             $phones[] = [
 -                 'data' => ['number' => $this->faker->phoneNumber],
 -                 'type' => 'primary',
 -             ];
 -         }
 - 
 -         if ($this->faker->boolean(50)) {
 -             $phones[] = [
 -                 'data' => ['number' => $this->faker->phoneNumber],
 -                 'type' => 'mobile',
 -             ];
 -         }
 - 
 -         if ($this->faker->boolean(30)) {
 -             $phones[] = [
 -                 'data' => ['number' => $this->faker->phoneNumber],
 -                 'type' => 'toll_free',
 -             ];
 -         }
 - 
 -         if ($this->faker->boolean(10)) {
 -             $phones[] = [
 -                 'data' => ['number' => $this->faker->phoneNumber],
 -                 'type' => 'fax',
 -             ];
 -         }
 - 
 -         return $phones;
 -     }
 - 
 -     public function primary(): self
 -     {
 -         return $this->state([
 -             'is_primary' => true,
 -         ]);
 -     }
 - 
 -     public function secondary(): self
 -     {
 -         return $this->state([
 -             'is_primary' => false,
 -         ]);
 -     }
 - }
 
 
  |