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.
Laravel | Package |
---|---|
5.5.x | 0.4.x |
5.6.x | 0.4.x |
5.7.x | 0.4.x |
5.8.x | 0.4.x |
6.x.x | 0.4.x |
7.x.x | 0.4.x |
8.x.x | 0.5.x |
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.
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
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
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...
If you discover any issues, please email lemonpatwari@gmail.com / hello@lemonpatwari.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.