Skip to main content

UpdateGeoAreaRequest

Form request class for validating GeoArea update data. Supports partial updates.

Namespace

JobMetric\Location\Http\Requests\GeoArea\UpdateGeoAreaRequest

Overview

Key features:

  • Partial updates: fields are optional (sometimes)
  • Translation fields require translation.*.name when translation is present
  • Optional locations array with duplicate tuple detection

Validation Rules

FieldRuleDescription
translationsometimes|arrayTranslation map
translation.*.namerequired|string|max:255Geo area name
translation.*.descriptionnullable|stringOptional description
statussometimes|booleanEnabled/disabled
locationssometimes|nullable|arrayLocation tuples
locations.*.country_idrequired|integer|exists:{countries},idCountry id
locations.*.province_idnullable|integer|exists:{provinces},idProvince id
locations.*.city_idnullable|integer|exists:{cities},idCity id
locations.*.district_idnullable|integer|exists:{districts},idDistrict id

Usage Example

use JobMetric\Location\Facades\GeoArea;

$response = GeoArea::update($geoAreaId, [
'translation' => [
'en' => [
'name' => 'Tehran Zone (Updated)',
'description' => 'Updated coverage.',
],
],
'locations' => [
['country_id' => 1, 'province_id' => 10, 'city_id' => 120],
],
]);