Files
backend/database/factories/HarimFactory.php
2025-09-07 14:25:10 +03:30

62 lines
2.8 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 [
'panjare_vahed_id' => $this->faker->numberBetween(1, 100),
'national_id' => $this->faker->numberBetween(1, 100),
'phone_number' => $this->faker->numerify('09#########'),
'state_id' => $this->faker->numberBetween(1,15),
'state_name' => function (array $attributes) {
return HarimState::query()->find($attributes['state_id'])->name;
},
'request_date' => $this->faker->date(),
'province_id' => Province::factory(),
'province_name' => function (array $attributes) {
return Province::query()->find($attributes['province_id'])->name_fa;
},
'city_id' => City::factory(),
'city_name' => function (array $attributes) {
return City::query()->find($attributes['city_id'])->name_fa;
},
'edareh_shahri_id' => EdarateShahri::factory(),
'requested_organization' => $this->faker->name,
'plan_group' => $this->faker->name,
'plan_title' => $this->faker->title,
'is_possible' => $this->faker->boolean(),
'worksheet_id' => $this->faker->uuid,
'response_options' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'isic' => $this->faker->text,
'primary_area' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'forbidden_area' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'final_area' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'final_plan' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'access_road' => json_encode(['type' => 'polygon', 'coordinates' => [[11.2, 22.2], [33.2, 44.2], [11.2, 22.2]]]),
'need_payment' => $this->faker->boolean(),
'payment_amount' => $this->faker->numberBetween(1000, 1000000),
'need_access_road' => $this->faker->boolean(),
'access_road_allowed' => $this->faker->boolean(),
'lat' => $this->faker->latitude,
'lng' => $this->faker->longitude,
];
}
}