Skip to content

Provide provinces/states, divisions, districts and tehsils/talukas relations database for Pakistan.

Notifications You must be signed in to change notification settings

aaqibmehran/geo-pakistan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Laravel Geo Pakistan Database

This package focused on Provinces/States, Divisions, Districts and Tehsils/Talukas database of Pakistan for Laravel. Additionally, population, area and density, is also added according to census of 2017. Latitude and longitude of the region center is also added.

Conceptions

There are 4 main objects in this package.

  • Provinces/States: 7
  • Divisions: 36
  • Districts: 154
  • Tehsils/talukas: 536

Localization

Right now, only English(default and fallback) is supported. We intend to add locale for urdu in the future updates.

Setup

  • composer require
composer require aaqib/geo-pakistan
  • Add Service Provider into config/app.php
'providers' => [
    // ...
    Aaqib\GeoPakistan\GeoPakistanServiceProvider::class,
]
  • Publish and init
php artisan vendor:publish --force --provider="Aaqib\GeoPakistan\GeoPakistanServiceProvider"
composer dump-autoload
php artisan geopakistan:init

Usage

  • get all Provinces
use Aaqib\GeoPakistan\Pakistan;

Pakistan::Provinces()
  • get all Divisions
use Aaqib\GeoPakistan\Division;

Pakistan::Divisions()
  • get divisions belong to a province
use Aaqib\GeoPakistan\Models\Province;

$punjab = Province::getByAbbr('PUN');
$divisions = $punjab->divisions()->get();
// or use children method
$divisions = $punjab->children();
  • get province or parent
    $rawalpindi = Division::getByName('Rawalpindi');
    $punjab = $rawalpindi->parent();
  • get parents of tehsil
// get district by tehsil
$lahore_city = Tehsil::getByName('Lahore City');
$Lahore = $lahore_city->district();

// get division by tehsil
$lahore_city = Tehsil::getByName('Lahore City');
$lahore = $lahore_city->division();

// get province by tehsil
$lahore_city = Tehsil::getByName('Lahore City');
$Punjab = $lahore_city->province();
  • get tehsils by province and division
// get by province
$punjab = Province::getByAbbr('PUN');
$tehsils = $punjab->tehsils()->get();

// get by division
$rawalpindi = Division::getByName('Rawalpindi');
$tehsils = $rawalpindi->tehsils()->get();

About

This package published under MIT license. If you have any question or suggestion, please feel free to submit an issue, or email me Aaqib Mehran mehran.aaqib@gmail.com.

Have a nice day.

About

Provide provinces/states, divisions, districts and tehsils/talukas relations database for Pakistan.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages