GitHub - ichtrojan/laravel-location: A simple Laravel Package to sort Countries,...
source link: https://github.com/ichtrojan/laravel-location
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
Laravel Location ▲
Introduction ?
This Package offers a simple way to get Countries, Cities and States that you may need for your Application, most especially for dropdown menus.
Installation ?
Step One
Require the package via composer into your project
composer require ichtrojan/laravel-location
Step Two
Next, publish the Seeders from the package
php artisan vendor:publish --tag=laravel-location-seeds
or Run
php artisan vendor:publish
You will end up with a selection like this
input the number that matches with Ichtrojan\Location\LocationServiceProvider
and press enter.
Step Three
Run migrations
before you do this make sure your correct Database credentials are set in the
.env
file
php artisan migrate
Finally, run the Package seeders
php artisan db:seed --class=LocationDatabaseSeeder
Usage ?
Endpoint Description/location/countries
return all countries
/location/country/{id}
return a single country by its ID
/location/states
return all states
/location/state/{id}
return a single state by its ID
/location/states/{countryID}
return all states in a country using the country ID
/location/cities
return all cities
/location/city/{id}
return a single city by its ID
/location/cities/{stateID}
return all cities in a state using the state ID
Contribution
Free for all, if you find an issue with the package or if a group of people somehow created a new country please send in a PR.
Danke Schön
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK