Method Listing
Below, you'll find a list of methods available in the Country model, along with friendly descriptions of what each method does. These methods are organized alphabetically for your convenience.
Order By Name
Sort countries by their name in either ascending or descending order.
->orderByName($sortMethod = 'asc')Country::orderByName('asc')->get();Where Area Km²
Find countries based on their area in square kilometers.
->whereAreaKm2()Country::whereAreaKm2(500000)->get();Where GDP
Filter countries by their Gross Domestic Product (GDP) in billions of USD.
->whereGdp()Country::whereGdp(1000)->get();Where Geoname
Find countries by their GeoNames ID. Use orWhereGeoname to add an OR condition to your query.
->whereGdp()Country::whereGeoname(123456)->first();Country::orWhereGeoname(789012)->first();Where Iso
Find countries by any ISO code (Alpha-2, Alpha-3, or Numeric). Use orWhereIso to add an OR condition.
->whereIso()Country::whereIso('US')->first();Country::orWhereIso('840')->first();Country::orWhereIso('840')
->orWhereIso('BR')
->orWhereIso('PTR')
->orWhereIso('USA')
->orWhereIso('US')
->orWhereIso('120')
->get();Where Iso Alpha 2
Find countries by their ISO Alpha-2 code. Use orWhereIsoAlpha2 to add an OR condition.
->whereIsoAlpha2()Country::whereIsoAlpha2('FR')->first();Country::orWhereIsoAlpha2('DE')->first();Where Iso Alpha 3
Find countries by their ISO Alpha-3 code. Use orWhereIsoAlpha3 to add an OR condition.
->whereIsoAlpha3()Country::whereIsoAlpha3('FRA')->first();Country::orWhereIsoAlpha3('DEU')->first();Where Iso Numeric
Find countries by their ISO Numeric code. Use orWhereIsoNumeric to add an OR condition.
->whereIsoNumeric()Country::whereIsoNumeric('250')->first();Country::orWhereIsoNumeric('276')->first();Where Language
Find countries where a specific language is spoken.
->whereLanguage()Country::whereLanguage('en')->get();Find countries where all specified languages are spoken.
->whereLanguages()Country::whereLanguages(['en', 'fr'])->get();Where Name
Find countries by their name. Use orWhereName to add an OR condition.
->whereName()Country::whereName('France')->first();Country::orWhereName('Germany')->first();Find countries where the name matches a pattern. Use orWhereNameLike to add an OR condition.
Country::whereNameLike('United')->get();Country::orWhereNameLike('Kingdom')->get();Where Official Name
Find countries by their official name. Use orWhereOfficialName to add an OR condition.
->whereOfficialName()Country::whereOfficialName('Republic of India')->first();Country::orWhereOfficialName('Commonwealth of Australia')->first();Find countries where the official name matches a pattern. Use orWhereOfficialNameLike to add an OR condition.
Country::whereOfficialNameLike('Republic')->get();Country::orWhereOfficialNameLike('Kingdom')->get();Where Phone Code
Find countries by their international phone code. Use orWherePhoneCode to add an OR condition.
->wherePhoneCode()Country::wherePhoneCode('+91')->first();Country::orWherePhoneCode('+81')->first();Where Population
Find countries with a specific population.
->wherePopulation()Country::wherePopulation(100000000)->get();Where Slug
Find countries by their slug (a URL-friendly name). Use orWhereSlug to add an OR condition.
->whereSlug()Country::whereSlug('france')->first();Country::orWhereSlug('germany')->first();Where UID
Find countries by their unique identifier (UID). Use orWhereUid to add an OR condition.
->whereUid()Country::whereUid('01ARZ3NDEKTSV4RRFFQ69G5FAV')->first();Country::orWhereUid('01ARZ3NDEKTSV4RRFFQ69G5FAV')->first();Where WMO
Find countries by their WMO (World Meteorological Organization) code.
All three methods do the same thing.
->whereWmo()
->whereWmoCode()
->whereWorldMeteorologicalOrganizationCode()Country::whereWmo('FR')->first();Country::whereWmoCode('DE')->first();Country::whereWorldMeteorologicalOrganizationCode('JP')->first();