ConsultantFactory.php
1 <?php 2 3 namespace Database\Factories; 4 5 use App\Models\Consultancy; 6 use App\Models\Consultant; 7 use App\Models\Country; 8 use Illuminate\Database\Eloquent\Factories\Factory; 9 10 class ConsultantFactory extends Factory 11 { 12 /** 13 * The name of the factory's corresponding model. 14 * 15 * @var string 16 */ 17 protected $model = Consultant::class; 18 19 /** 20 * Define the model's default state. 21 * 22 * @return array 23 */ 24 public function definition() 25 { 26 return [ 27 'name' => $this->faker->name(), 28 'position' => $this->faker->word(), 29 'telephone' => $this->faker->phoneNumber(), 30 'country_id' => Country::all()->random()->id, 31 'consultancy_id' => Consultancy::all()->random()->id, 32 ]; 33 } 34 }