定制 metalgeek/states-and-local-govt 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

metalgeek/states-and-local-govt

Composer 安装命令:

composer require metalgeek/states-and-local-govt

包简介

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

README 文档

README

A Laravel Package that populates your database with all the states in the Nigeria and their corresponding local governments.

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

...
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;

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-06