edersoares / eloquent-uuid
该软件包已被弃用且不再维护。未建议替代软件包。
一个简单的软件包,用于在Eloquent模型中通用唯一标识符(UUID)。
dev-master
2018-03-12 23:23 UTC
Requires
- php: ~7.0
- illuminate/database: ~5.5
- illuminate/support: ~5.5
- ramsey/uuid: ~3.7
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2023-03-26 09:32:54 UTC
README
一个简单的软件包,用于在Eloquent模型中将通用唯一标识符(UUID)用作主键。
此软件包使用Uuid库,该库在Laravel框架中使用,以生成UUID。
安装
composer require edersoares/eloquent-uuid
使用方法
- 在迁移文件中进行替换
// From $table->increments('id'); // To $table->uuid('uuid')->unique(); $table->primary('uuid')
- 之后,在您的模型中使用
Nix\Eloquent\Uuid\Uuid
特质
use Illuminate\Database\Eloquent\Model; use Nix\Eloquent\Uuid\Uuid; class SomeModel extends Model { use Uuid; }
致谢
本软件包使用
并基于以下项目