Skip to main content

StoreLocationRequest

Form request class for validating Location creation data.

Namespace

JobMetric\Location\Http\Requests\Location\StoreLocationRequest

Overview

Locations represent unique tuples of:

  • country_id
  • province_id (optional)
  • city_id (optional)
  • district_id (optional)

The Location service uses firstOrCreate() to guarantee uniqueness.

Validation Rules

FieldRuleDescription
country_idrequired|integer|exists:{countries},idCountry id
province_idnullable|integer|exists:{provinces},idProvince id
city_idnullable|integer|exists:{cities},idCity id
district_idnullable|integer|exists:{districts},idDistrict id

Usage Example

use JobMetric\Location\Facades\Location;

$response = Location::store([
'country_id' => 1,
'province_id' => 10,
'city_id' => 120,
'district_id' => 900,
]);