Coder Social home page Coder Social logo

laravel-region's Introduction

Region

基于高德开放平台 的PHP 三级联动数据生成器。

安装

$ composer require lysice/laravel-region -vvv

配置

在使用本扩展之前,你需要去 高德开放平台 注册账号,然后创建应用,获取应用的 API Key。

使用

1.发布配置文件与迁移

    php artisan vendor:publish --provider=Lysice\Region\RegionServiceProvider

2.配置项

config文件里生成的region.php中的配置项一共有四个分别是

  • table 标识要生成迁移的表名
  • connection 标识要使用的数据库连接配置名,对应database.php中的connections选项中的配置 如设置成mysql 则会使用 config('database.connections.mysql')的配置。
  • key 高德开放平台创建应用的key
  • prefix 标识要生成的表名前缀

3.生成迁移表

    php artisan migrate

4.生成数据 可以使用三种方式

方法参数注入Region实例生成

    public function region(Region $region) 
    {
        $response = $region->region();
    }

服务名访问实例方法

public function edit() 
{
    $response = app('region')->region();
}

命令行执行

    php artisan region:generate

之后在数据库你生成的表结构

参考

高德开放平台接口

License

MIT

laravel-region's People

Contributors

lysice avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.