create and change code

This commit is contained in:
2025-09-07 14:25:10 +03:30
parent 4594415cec
commit c64fc22ed3
9 changed files with 138 additions and 70 deletions

View File

@@ -21,38 +21,41 @@ class HarimFactory extends Factory
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;
},
'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;
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;
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(),
'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,
];
}
}

View File

@@ -25,17 +25,13 @@ class HarimHistoryFactory extends Factory
'previous_state_name' => function (array $attributes) {
return HarimStates::query()->find($attributes['state_id'])->name;
},
'current_state_id' => HarimState::factory(),
'current_state_name' => function (array $attributes) {
return HarimState::query()->find($attributes['state_id'])->name;
},
'action_id' => HarimAction::factory(),
'action_name' => function (array $attributes) {
return HarimAction::query()->find($attributes['state_id'])->name;
},
'expert_id' => User::factory(),
'expert_description' => $this->fake()->text,
'previous_data' => json_encode(['fake']),
];
}
}

View File

@@ -34,11 +34,11 @@ return new class extends Migration
$table->string('worksheet_id');
$table->json('response_options')->nullable();
$table->string('isic');
$table->polygon('primary_area');
$table->polygon('forbidden_area')->nullable();
$table->polygon('final_area')->nullable();
$table->polygon('final_plan')->nullable();
$table->polygon('access_road')->nullable();
$table->json('primary_area');
$table->json('forbidden_area')->nullable();
$table->json('final_area')->nullable();
$table->json('final_plan')->nullable();
$table->json('access_road')->nullable();
$table->boolean('need_payment')->nullable();
$table->string('payment_amount')->nullable();
$table->boolean('need_access_road')->nullable();