2017 © Pedro Peláez
 

library states-and-local-govt

Populates your DB with all the states in Nigeria and their local governments. It also creates the models for you

image

bodunde/states-and-local-govt

Populates your DB with all the states in Nigeria and their local governments. It also creates the models for you

  • Friday, October 14, 2016
  • by badebiyi
  • Repository
  • 1 Watchers
  • 2 Stars
  • 42 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 17 % Grown

The README.md

Laravel-Nig-States-LocalGovt

A Laravel Package that populates your database with all the states in the Nigeria and their corresponding local governments., (*1)

Setup

  • Include package in your project by running composer require bodunde/states-and-local-govt
  • Add Bodunde\SLG\SLGServiceProvider::class to provider in app.php under config directory
  • Publish package resources by running php artisan vendor:publish. Running this command would publish models, migrations and seeders.
  • Run published migrations php artisan migrate
  • Regenerate your autoload files composer dump-autoload
  • Run published database seeders php artisan db:seed --class=SlgTableSeeder

Usage

  • Import models into your controllers

Note: If your root namespace in your application isn't app make sure you go to the models and modify the namespace, (*2)

...
use App\State;
use App\LocalGovt;

...
...
// fetch all states
$states = State::all();

// fetch state by id
$state = State::find($id) // where $id = 1

// fetch state by name
$state = State::findByName("Lagos State");

//get state local governments
$lg = $state->localGovernments;

// get all local governments
$lgs = LocalGovt::all();

// fetch local government by id
$lg = LocalGovt::find($id) // where $id = 1

// fetch local government state
$state = $lg->state;

The Versions

14/10 2016

dev-master

9999999-dev

Populates your DB with all the states in Nigeria and their local governments. It also creates the models for you

  Sources   Download

MIT

The Requires

 

by Adebiyi Bodunde

14/10 2016

v1.0

1.0.0.0

Populates your DB with all the states in Nigeria and their local governments. It also creates the models for you

  Sources   Download

MIT

The Requires

 

by Adebiyi Bodunde