59 lines
2.2 KiB
PHP
59 lines
2.2 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,15),
|
|
'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_fa;
|
|
},
|
|
'city_id' => City::factory(),
|
|
'city_name' => function (array $attributes) {
|
|
return City::query()->find($attributes['city_id'])->name_fa;
|
|
},
|
|
'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()),
|
|
'need_road_access' => $this->faker->boolean(),
|
|
'is_file_good' => $this->faker->boolean(),
|
|
'is_possible' => $this->faker->boolean(),
|
|
];
|
|
}
|
|
}
|