Download the PHP package itparlour/laravel-location without Composer
On this page you can find all versions of the php package itparlour/laravel-location. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-location
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.
Step One - Install via Composer ๐ผ
Require the package via composer into your project
Step Two - Publish Configurations โ๏ธ
Laravel location provides you with an easy way of customizing the tables used for storing Countries, States and Cities. Also, you can customisethe route prefix and middleware. To customize these you need to publish the configuration file. To publish the configuration file, run:
php artisan vendor:publish --tag=laravel-location
You will have config/location.php
available for you to edit. The default configurations are:
You can go ahead and customize the table names
, route prefix
and middleware
as you need before running the Migration.
Step Three - Running Migrations
before you do this make sure your correct Database credentials are set in the
.env
file
Finally, run the Package seeders
Usage ๐งจ
NOTE
The routes below are prefixed withlocation
which is the default configuration set in theconfig/location.php
file. If mofified, replace the prefixin your route with the correct prefix.
Route | 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 |
Test
composer test