rvzug/laravel-possible-composite-key
Composer 安装命令:
composer require rvzug/laravel-possible-composite-key
包简介
PHP trait to use composite keys in your Laravel Eloquent models and does not fail on possible missing column.
README 文档
README
PHP trait to use composite keys in your Laravel Eloquent models and does not fail on possible missing column.
Installation:
composer require rvzug/laravel-possible-composite-key
Usage:
<?php use Rvzug\CanHasCompositeKey; use Illuminate\Database\Eloquent\Model; class MyModel extend Model { use CanHasCompositeKey; protected $primaryKey = ['one', 'two', 'three']; public $incrementing = false; }
In your migrations / database it's now possible to add Nullable to 'one', 'two', 'three'. Assuming that at least one of the other is filled with a near-unique value. For example an ArticleCode or Gtin value. In my usages I use keys: 'ArticleCode', 'EanCode', 'Supplier', where code and ean could be empty. The combination of Supplier and one of the codes is reasonably unique.
统计信息
- 总下载量: 76
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-18