*/ class AzmayeshFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'azmayesh_type_id' => AzmayeshType::factory(), 'azmayesh_type_name' => function (array $attributes) { return AzmayeshType::query()->find($attributes['azmayesh_type_id'])->name; }, 'province_id' => Province::factory(), 'province_name' => function (array $attributes) { return Province::query()->find($attributes['province_id'])->name; }, ]; } }