Skip to main content

CityResource

JSON resource class for transforming City models into structured API responses.

Namespace

JobMetric\Location\Http\Resources\CityResource

Base Properties

PropertyTypeDescription
idintCity ID
namestringCity name
statusboolEnabled/disabled

Conditional Properties

PropertyRelationType
countrycountryCountryResource
provinceprovinceProvinceResource
districtsdistrictsarray<DistrictResource>

Usage Example

use JobMetric\Location\Http\Resources\CityResource;
use JobMetric\Location\Models\City;

$city = City::with(['province', 'districts'])->find(120);

return CityResource::make($city);