rafwell/laravel-municipios

为 Laravel 提供市和 UFS 的 Models、Migrations 和 Seeds。

dev-master 2016-08-11 17:48 UTC

This package is auto-updated.

Last update: 2024-08-29 03:58:11 UTC


README

##关于项目 rafwell/laravel-municipios 是一个包含巴西市和 UFS 的 Models、Migrations 和 Seeds 的包,用于在 Laravel > 5 系统中使用。

##通过 Composer 安装

  1. 将以下内容添加到您的 composer.json 中: "rafwell/laravel-municipios": "dev-master" 并执行 composer update
  2. 将以下 provider 添加到您的 app/config/app.php 中:
    Rafwell\Municipios\RafwellMunicipiosServiceProvider::class
    
  3. 执行: php artisan vendor:publish。这将创建在您的项目中的 app 目录下的 Models:UF 和 Municipio,用于创建表格:ufs 和 municipios(与 ufs 表的外键关联)以及用于在两个表格中加载数据的 Seeds。
  4. 执行迁移以创建表格: php artisan migrate
  5. 执行 composer dumpautoload
  6. 执行 Seeds 以加载数据到表格: php artisan db:seed --class=insere_ufsphp artisan db:seed --class=insere_municipios

##手动安装 克隆仓库或下载最新版本,将 src/ 目录下的文件复制到您的项目中。然后,执行 composer dumpautoloadphp artisan migratephp artisan db:seed --class=insere_ufsphp artisan db:seed --class=insere_municipios

##使用方法 配置完成后,将 Models 添加到您的 Controllers 中并按需使用。

##注意事项 市表格的 id 是 IBGE 市代码。uf 列是 municipios 表的外键。如果您发现某个市未在包中,请创建一个 Issue 或向我们发送一个 PR。 :)