ichtrojan / laravel-location
Fund package maintenance!
rave.flutterwave.com/pay/trojantjkf
Installs: 2 866
Dependents: 0
Suggesters: 0
Security: 0
Stars: 207
Watchers: 5
Forks: 43
Open Issues: 2
Requires
- illuminate/support: ^5.0 || ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- illuminate/contracts: ^5.8.15|^6.0
- illuminate/database: ^5.8.15|^6.0
- illuminate/filesystem: ^5.8.15|^6.0
- illuminate/support: ^5.8.15|^6.0
- mockery/mockery: ^1.0
- orchestra/testbench: 3.8.*|4.*
- phpunit/php-code-coverage: ^7.0@dev
- phpunit/phpunit: ^8.0
README
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
composer require ichtrojan/laravel-location
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:
<?php return [ 'countries_table' => 'countries', 'cities_table' => 'cities', 'states_table' => 'states', 'routes' => [ 'prefix' => 'location', 'middleware' => 'web' ] ];
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
php artisan migrate
Finally, run the Package seeders
php artisan db:seed --class=Ichtrojan\\Location\\Seeds\\LocationDatabaseSeeder
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.
Test
composer test
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