2017 © Pedro Peláez
 

library ghregionsdistrict

Laravel package to get Ghana's regions and districts

image

wapnen/ghregionsdistrict

Laravel package to get Ghana's regions and districts

  • Saturday, March 3, 2018
  • by wapnen
  • Repository
  • 1 Watchers
  • 2 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

GhRegionsDistrict

Laravel package for retreiving Ghana's regions and districts, (*1)

Installation

PHP 5.4+ and Composer are required., (*2)

To get the latest version of this package add the following block of code to the require block of your project's composer.json, (*3)

"wapnen/GHRegionsDistrict": "1.0.*"

You'll then need to run composer install or composer update to download it and have the autoloader updated., (*4)

Once GhRegionsDistrict is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key., (*5)

  • Wapnen\GhRegionDistrict\GhRegionDistrictServiceProvider::class,

Configuration

To start using this package, you'll need to publish all vendor assets:, (*6)

$ php artisan vendor:publish --provider="Wapnen\GhRegionDistrict\GhRegionDistrictServiceProvider"

Now migrate your database to include the regions and districts tables, (*7)

$ php artisan migrate

Add the following to your application's Databaseseeder.php file, (*8)

        $this->call(RegionTableSeeder::class);
        $this->call(District1TableSeeder::class);
        $this->call(District2TableSeeder::class);   
        $this->call(District3TableSeeder::class);
        $this->call(District4TableSeeder::class);
        $this->call(District5TableSeeder::class);
        $this->call(District6TableSeeder::class);
        $this->call(District7TableSeeder::class);
        $this->call(District8TableSeeder::class);
        $this->call(District9TableSeeder::class);
        $this->call(District10TableSeeder::class);

run the following command to Autoload your files, (*9)

composer dump-autoload

Finally run the following command to seed to your database, (*10)

$ php artisan db:seed

Usage

To retrieve all the regions, (*11)

$regions = DB::table('regions')->get();

To retrieve one region, (*12)

$region = DB::table('regions')->where('name', 'Ashanti)->first();

To get all the districts for a particular region, (*13)

$region = DB::table('regions')->where('name', 'Ashanti)->first();
$districts = DB::table('districts)->where('region_id' , $region->id)->get();

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities., (*14)

You can follow me on twitter!, (*15)

License

The MIT License (MIT)., (*16)

The Versions

03/03 2018

dev-master

9999999-dev

Laravel package to get Ghana's regions and districts

  Sources   Download

MIT

by Wapnen Gowok

laravel districts regions ghana