lemonpatwari / bangladeshgeocode
Bangladesh Geocode
v2.0.4
2021-09-07 18:08 UTC
README
Division, District, Upazila/Thana and Union data of Bangladesh for Laravel application. Migration and seeders are ready. Just publish migrations and seeders and then migrate the db and run the seed command.
Do not hesitate to share your thought, create issue or send pull request.
Laravel Version Compatibility
Installation
You can install the package via composer:
composer require lemonpatwari/bangladeshgeocode
Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
Laravel without auto-discovery:
php artisan vendor:publish --provider="lemonpatwari\bangladeshgeocode\BangladeshGeocodeServiceProvider" #If you need to overrride previously published migrationa and seeders php artisan vendor:publish --provider="lemonpatwari\bangladeshgeocode\BangladeshGeocodeServiceProvider" --force
Publish Migration and seeders
You can publish migration and seeders via single command:
php artisan geolocation:install
You can publish migration and seeders via different command:
php artisan migrate composer dump-autoload php artisan db:seed --class=DivisionSeeder php artisan db:seed --class=DistrictSeeder php artisan db:seed --class=ThanaSeeder php artisan db:seed --class=UnionSeeder
Usage
use lemonpatwari\bangladeshgeocode\Models\Division; use lemonpatwari\bangladeshgeocode\Models\District; use lemonpatwari\bangladeshgeocode\Models\Thana; use lemonpatwari\bangladeshgeocode\Models\Union; $divisions = Division::all(); $districts = District::all(); $thanas = Thana::all(); $union = Union::all(); $divisions = Division::with('districts')->get(); // districts hasMany $districts = District::with('division','thanas')->get(); //division belongsTo and thanas hasMany $thanas = Thana::with('district','unions')->get(); //district belongsTo and unions hasMany; $union = Union::all(); $district = District::find(1); $thanas = $district->thanas; //Use any Laravel model functions...
Security
If you discover any issues, please email lemonpatwari@gmail.com / hello@lemonpatwari.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.