定制 tishotm/eloquent-ci-relations 二次开发

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

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

tishotm/eloquent-ci-relations

最新稳定版本:v1.5.0

Composer 安装命令:

composer require tishotm/eloquent-ci-relations

包简介

Eloquent case-insensitive relations

README 文档

README

Build Status Version Total Downloads License

Using Eloquent out of the box on case-insensitive collation databases could potentially return incomplete collection of items if the foreign keys are set as strings and they differ in terms of uppercase vs lowercase. On eager loaded relations Eloquent builds a dictionary of the parent models and associates their related models by their keys. PHP is case-sensitive and therefore if the keys are different, then some of the related models will not be returned. This package simply normalizes the dictionary keys into lowercase.

Example:

Items table

uuid name
aaa First
bbb Second
ccc Third

Tags table

id label
1 tag 1
2 tag 2
3 tag 3

item_tag table

item_uuid tag_id
AAA 1
aaa 2
bbb 3

Item::with('tags')->find('aaa');

The related tags would include only the "tag 2" even if the the DB collation is case-insensitive and the returned query data includes "tag 1".

With case insensitive relations: The related tags would include both "tag 1" and "tag 2".

Requirements

  • illuminate/database 5.5.33 and up, 5.6.*, 5.7.*, 5.8.*, 6.20.26 and up, 7.30.4, 8.40.0 an up

Installation

composer require tishotm/eloquent-ci-relations

Usage

use Illuminate\Database\Eloquent\Model;

class Item extends Model
{
    use \TishoTM\Eloquent\Concerns\HasCiRelationships;

    // ... relations
}

License

MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固