thehocinesaad/laravel-algereography 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

thehocinesaad/laravel-algereography

Composer 安装命令:

composer require thehocinesaad/laravel-algereography

包简介

Easily add all the 58 Algerian Wilayas and its Dairas to your cool Laravel project (Migrations, Seeders and Models).

README 文档

README

Laravel-Algereography

Laravel-Algereography allows you to add Migrations, Seeders and Models of Algerian Wilayas and Dairas to your existing or new cool Laravel project .

- 58 Wilayas.
- 548 Dairas.
- Support both Arabic and French languages.
- Built in models relationships, so you can for example do: Daira::find(1)->wilaya to get the Wilaya of Daira with the id=1.

Installation

Step 1 - Require the package

composer require thehocinesaad/laravel-algereography

Step 2: Install the package

php artisan algereography:install

This command will do those good stuff for you:

  1. Publish two Models, Wilaya and Daira to app/Models.

  2. Publish two Migrations, create_wilayas_table and create_dairas_table to database/migrations

  3. Publish two Seeders, WilayaSeeder and DairaSeeder to database/seeders

  4. Run the two Migrations (create_wilayas_table and create_dairas_table)
    Note: this operation will automatically overwrite any table with the name of wilayas and dairas

  5. Run the two Seeders (WilayaSeeder and DairaSeeder)

  6. Finally, it prints Done! to make you know that everything is succefully finished then it will print 1 2 3 Viva l'Algérie! just to make you a little bit proud of your country ❤️

Step 3:

There is no step 3, you're done 😉
Check out your database and you will find two new tables, wilayas and dairas.

How can I use the package

As mentioned before, the package publishes two models Wilaya and Daira, use them just like any other model in your project.

Get all Wilayas

Wilaya::all();

Get all Dairas

Daira::all();

Get Dairas of a Wilaya

Wilaya::findOrFail(15)->dairas

Get Wilaya of a Daira

Daira::findOrFail(205)->wilaya;

Note: Don't forget to import the models first:

use App\Models\Wilaya;
use App\Models\Daira;

Helpers

You can also use the package using some Helpers I added that will make your life easier.

Helpers list:

$wilayas     =   wilayas();           // Get all Wilayas in all languages
$ar_wilayas  =   wilayas('ar');       // Get all Wilayas in arabic
$ar_wilayas  =   wilayas('fr');       // Get all Wilayas in french

//

$wilaya      =   wilaya(15);          // Get individuel Wilaya in all languages
$ar_wilaya   =   wilaya(15, 'ar');    // Get individuel Wilaya in arabic
$wilaya      =   wilaya(15, 'fr');    // Get individuel Wilaya in french

//

$dairas      =   dairas();            // Get all Dairas in all languages             
$ar_dairas   =   dairas('ar');        // Get all Dairas in arabic 
$fr_dairas   =   dairas('fr');        // Get all Dairas in french

//

$dairas      =   dairasOf(15);        // Get all Dairas of a Wilaya in all languages
$dairas      =   dairasOf(15, 'ar');  // Get all Dairas of a Wilaya in arabic
$dairas      =   dairasOf(15, 'fr');  // Get all Dairas of a Wilaya in french
When specifying the language, to access the name attribute just do ->name and it will automatically get the name in the correct language, so there is no need to do ->ar_name to get the name in arabic.

Example

$fr_wilaya  =  wilaya(15, 'fr');   // $fr_wilaya->name will be 'Tizi Ouzou' 
$ar_wilaya  =  wilaya(15, 'ar');   // $ar_wilaya->name will be 'تيزي وزو' 

How cool is that!

Contributing

Thank you for considering contributing to Laravel-Algereography project! Feel free to contribute in any way, we welcome every contribution.

License

Laravel-Algereography project is open-sourced software licensed under the MIT license.

thehocinesaad/laravel-algereography 适用场景与选型建议

thehocinesaad/laravel-algereography 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 208 次下载、GitHub Stars 达 53, 最近一次更新时间为 2022 年 09 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「thehocinesaad」 「laravel-algereography」 「Wilayas」 「Dairas」 「Provinces of Algeria」 「Districts of Algeria」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 thehocinesaad/laravel-algereography 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 thehocinesaad/laravel-algereography 我们能提供哪些服务?
定制开发 / 二次开发

基于 thehocinesaad/laravel-algereography 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 53
  • Watchers: 3
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-02