Skip to main content

District Service

The District service manages districts within a specific city.

Facade

use JobMetric\Location\Facades\District;

Basic CRUD Operations

Store

Create a new district.

$response = District::store([
'city_id' => 120,
'name' => 'District 1',
'status' => true,
]);

The name uniqueness is validated within the parent city.

Show

$response = District::show($districtId);

// With relations (if defined)
$response = District::show($districtId, ['city']);

Update

$response = District::update($districtId, [
'city_id' => 120,
'name' => 'District 1 (Updated)',
]);

Destroy / Restore / Force Delete

$response = District::destroy($districtId);
$response = District::restore($districtId);
$response = District::forceDelete($districtId);

Toggle Status

$response = District::toggleStatus($districtId);

Querying

// Get all districts for a city
$response = District::all(['city_id' => 120]);