fix: load cities dynamically based on selected province
This commit is contained in:
@@ -8,12 +8,14 @@ use Illuminate\Http\JsonResponse;
|
||||
|
||||
class LocationController extends Controller
|
||||
{
|
||||
public function getCities($provinceId): JsonResponse
|
||||
public function getCities(int $provinceId): JsonResponse
|
||||
{
|
||||
$cities = City::where('province_id', $provinceId)
|
||||
->orderBy('name')
|
||||
$cities = City::query()
|
||||
->where('province_id', $provinceId)
|
||||
->orderBy('name', 'asc')
|
||||
->get(['id', 'name']);
|
||||
|
||||
|
||||
return response()->json($cities);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user