added countries support expanded for ISO 3166 standard merged in new support

This commit is contained in:
Mark Gregory
2026-06-15 10:31:58 +01:00
parent 6acc6de707
commit 57d2507db9
19 changed files with 1118 additions and 120 deletions
@@ -27,15 +27,18 @@ class CountriesApiController extends Controller
->orWhere('official_name', 'ilike', "%{$search}%")
->orWhere('common_name', 'ilike', "%{$search}%")
->orWhere('display_name', 'ilike', "%{$search}%")
->orWhere('native_name', 'ilike', "%{$search}%")
->orWhere('alpha2', 'ilike', "%{$search}%")
->orWhere('alpha3', 'ilike', "%{$search}%")
->orWhere('numeric', 'ilike', "%{$search}%")
->orWhere('region', 'ilike', "%{$search}%")
->orWhere('subregion', 'ilike', "%{$search}%");
->orWhere('subregion', 'ilike', "%{$search}%")
->orWhere('currency_code', 'ilike', "%{$search}%")
->orWhere('calling_code', 'ilike', "%{$search}%");
});
})
->ordered()
->get(['alpha2', 'alpha3', 'numeric', 'name', 'official_name', 'common_name', 'display_name', 'flag_emoji', 'is_active', 'iso_status', 'independent', 'region', 'subregion']);
->get();
return response()->json(['data' => $countries]);
}
@@ -45,8 +48,7 @@ class CountriesApiController extends Controller
*/
public function active(): JsonResponse
{
$countries = Country::query()->active()->ordered()
->get(['alpha2', 'alpha3', 'numeric', 'name', 'display_name', 'common_name', 'flag_emoji', 'region', 'subregion']);
$countries = Country::query()->active()->ordered()->get();
return response()->json(['data' => $countries]);
}
@@ -85,7 +87,7 @@ class CountriesApiController extends Controller
->where('country_id', $country->id)
->when($activeOnly, fn ($query) => $query->where('is_active', true))
->ordered()
->get(['country_alpha2', 'code', 'subdivision_code', 'name', 'local_name', 'type', 'is_active', 'iso_status']);
->get();
return response()->json(['data' => $subdivisions]);
}