Files
backend/database/factories/HarimFactory.php
2025-08-04 12:06:18 +03:30

56 lines
2.0 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\City;
use App\Models\EdarateShahri;
use App\Models\HarimState;
use App\Models\Province;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Harim>
*/
class HarimFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'state_id' => $this->faker->numberBetween(1,5),
'state_name' => function (array $attributes) {
return HarimState::query()->find($attributes['state_id'])->name;
},
'first_name' => $this->faker->firstName(),
'last_name' => $this->faker->lastName(),
'phone_number' => $this->faker->numerify('09#########'),
'request_number' => $this->faker->numerify(),
'request_date' => $this->faker->date(),
'province_id' => Province::factory(),
'province_name' => function (array $attributes) {
return Province::query()->find($attributes['province_id'])->name;
},
'city_id' => City::factory(),
'city_name' => function (array $attributes) {
return City::query()->find($attributes['city_id'])->name;
},
'edareh_shahri_id' => EdarateShahri::factory(),
'county' => $this->faker->citySuffix,
'division' => $this->faker->word,
'village' => $this->faker->name,
'grand_area' => $this->faker->numberBetween(1,100),
'plan_area' => $this->faker->numberBetween(1,100),
'requested_organization' => $this->faker->name,
'plan_group' => $this->faker->name,
'plan_title' => $this->faker->title,
'address' => $this->faker->address,
'file' => $this->faker->name,
'polygon' => json_encode($this->faker->numerify()),
];
}
}