LaboratoryRepresentativeFactory.php
1 <?php 2 3 namespace Database\Factories; 4 5 use App\Models\Laboratory; 6 use App\Models\LaboratoryRepresentative; 7 use Illuminate\Database\Eloquent\Factories\Factory; 8 use Illuminate\Support\Str; 9 10 class LaboratoryRepresentativeFactory extends Factory 11 { 12 /** 13 * The name of the factory's corresponding model. 14 * 15 * @var string 16 */ 17 protected $model = LaboratoryRepresentative::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 'dni' => Str::random(9), 29 'username' => $this->faker->username(), 30 'position' => $this->faker->word(), 31 'email' => $this->faker->email(), 32 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 33 'laboratory_id' => Laboratory::all()->random()->id, 34 ]; 35 } 36 }