定制 mahdiabbariki/iranprovinces 二次开发

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

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

mahdiabbariki/iranprovinces

Composer 安装命令:

composer require mahdiabbariki/iranprovinces

包简介

This package includes models and tables for provinces and their respective cities, which will be integrated into your project.

README 文档

README

This package offers functionality to manage Iran's provinces and cities through database tables. It comes with flexible configuration options, allowing you to:

  • Choose whether or not to create a table for cities.
  • Decide whether to include latitude and longitude data in the cities table.
  • Add or exclude timestamps in the tables.

Persian Install Guide

راهنمای نصب فارسی

Installation

To get started, run the following command:

    composer require MahdiAbbariki/IranProvinces

For Laravel Versions Prior to v6

For Laravel versions older than v6, you need to add the following line to the providers array in the config/app.php file:

    'providers' => [
    // ...
    MahdiAbbariki\IranProvinces\IranProvincesServiceProvider::class, // Add this line at the end of the provider array
    ],

the package is successfully integrated into your project.

After that, run the following command to publish the package's configuration, migration, and seeder files:

    php artisan vendor:publish --provider="MahdiAbbariki\IranProvinces\IranProvincesServiceProvider"

Make sure to edit the configuration file ( config/iranProvinces.php ) to match your specific requirements. The default configurations are suitable for most users.

Once you've customized the configuration, run your migrations.

    php artisan migrate

Seeding

You have two options for seeding the data.

You can execute this command to run the designated seeders included with this package:

    php artisan province:seed

Alternatively, you can add the following lines to the run method in the DatabaseSeeder class located in the database/seeders directory:

    $this->call([
        //...
        \MahdiAbbariki\IranProvinces\Database\Seeders\IranProvincesTableSeeder::class,
        \MahdiAbbariki\IranProvinces\Database\Seeders\IranProvincesCitiesTableSeeder::class,
        //...
    ]);

then you can use the built-in laravel seed command:

    php artisan db:seed

Now, your models and tables are ready for use.

Examples

Here are some examples of how to use them:

    use MahdiAbbariki\IranProvinces\Models\Province;
    use MahdiAbbariki\IranProvinces\Models\City;

    $province = Province::find(1);
    $cities = $province->cities;

    $city = City::find(1);
    $province = $city->province;

Contribution

If you encounter any bugs, please report them to info@mahdiab.ir. Your contributions are welcome!

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固