Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Countries Laravel Package

drnd-dev/laravel-countries

View on GitHub
Deep Wiki
Context7

Workflow

Usage

To start using CountryGeographical::class, just add this to your code:

use Lwwcas\LaravelCountries\Models\CountryGeographical;

$geo = CountryGeographical::inRandomOrder()->first();
$geo->getGeoData();

Usage With a Country

The CountryGeographical data is designed to be seamlessly integrated with country-specific information.

use Lwwcas\LaravelCountries\Models\Country;

$country = Country::inRandomOrder()->first();
$geo = $country->geographical()->first();

$geoData = $geo->getGeoData();

or directly

use Lwwcas\LaravelCountries\Models\Country;

$country = Country::inRandomOrder()->first();
$geoData = $country->getGeoData();

Adding CountryGeographical to Queries

In Laravel, you can easily include the geographical information of a country by leveraging the with() method when querying countries. This allows you to load the CountryGeographical data alongside the country model, providing access to region codes, time zones, and other geographical properties.

Example Usage

To retrieve a country along with its geographical data, simply use the following query:

$country = Country::with('geographical')->find($id);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode