Address form
Dependent dropdowns from the JSON routes of laravel-world (country, state, city) and, for Türkiye, from the
provinces and districts that turkiye:seed wrote to the database. The postal code is validated for
the chosen country with laravel-postcodes, and for Türkiye also against the province's plate code.
laravel-world
laravel-turkiye
laravel-postcodes
Result
Submit the form to see the canonical postal code and the resolved names.
How it works
#[validate(required, PostalCode::from_field("country"))]
pub postal_code: String,
// Added in ValidatesRequest::rules when the country is TR:
rules.field("district", [Rule::custom(DistrictOfProvince::new("province"))])
.field("postal_code", [Rule::custom(TurkishPostalCode::in_province("province"))])
JSON routes: /world/countries/{country}/states, /world/countries/{country}/states/{state}/cities, /address/provinces, /address/provinces/{il}/districts.