定制 znck/cities 二次开发

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

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

znck/cities

Composer 安装命令:

composer require znck/cities

包简介

A list of cities

README 文档

README

A cities list provider for Laravel.

Cities

StyleCI Status Build Status Coverage Status Software License Packagist Latest Version Issues

Installation

Either PHP 7.0+ is required.

To get the latest version of cities, simply require the project using Composer:

$ composer require znck/cities

Instead, you may of course manually update your require block and run composer update if you so choose:

{
    "require": {
        "znck/cities": "^0.1.2"
    }
}

Once Cities is installed, you have to register its service provider. Open config/app.php and add Znck\Cities\CitiesServiceProvider::class to providers key. Your config/app.php should look like this.

<?php return [
  // ...
  'providers' => [
    // ....
    Znck\Cities\CitiesServiceProvider::class,
  ]
  // ...
];

Usage

<?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Znck\Cities\City as CityTrait;

class City extends Model {
  use CityTrait;
}
  • Cities provides command (php artisan cities:update) to update list in database.

Configuration

Table names for cities and states are required. By default cities and states are used, but you can override these.

To get started, you'll need to publish all vendor assets:

php artisan vendor:publish --provider='Znck\Cities\CitiesServiceProvider'

This will create a config/cities.php file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

Conventions

Expected schema:

Schema::create('countries', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('code', 2)->unique();
    $table->timestamps();
});

Schema::create('states', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('code', 5)->unique();
    $table->unsignedInteger('country_id');
    $table->timestamps();

    $table->foreign('country_id')->references('id')->on('countries');
});

Schema::create('cities', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('code', 10)->unique();
    $table->unsignedInteger('state_id');
    $table->timestamps();

    $table->foreign('state_id')->references('id')->on('states');
});

Development plan

  • Create minimal working package.
  • Add migrations.
  • Integrate znck/state and znck/countries.
  • Add major cities of India.
  • Add translations in all 23 languages.
  • Add major cities of World.

License

Cities is licensed under The MIT License (MIT).

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固