larastuffs/primary-uuid
Composer 安装命令:
composer require larastuffs/primary-uuid
包简介
Use UUID as primary key on Laravel Models
README 文档
README
this package provides a simple interface for using UUID as a primary key in models
Requirements
- PHP 7.2 or latest
- Laravel 6.* | 7.* | 8.*
Installation
Require this package with composer using the following command:
composer require larastuffs/primary-uuid
Usage
Follow the instructions to adapt your models and migrations
Model Setup
<?php use ...; use LaraStuffs\PrimaryUUID\Eloquent\Concerns\UseUUIDAsPrimaryKey; class MyModel extends Model { use UseUUIDAsPrimaryKey; ... }
Migration Setup
<?php Schema::create('table_name', function (Blueprint $table) { $table->uuid('id')->primary(); });
Possible incompatibilities
if you use closures to define your model events, I strongly recommend that you use model observers instead
Contributing
Contributions are more than welcome. Fork, improve and make a pull request. For bugs, ideas for improvement or other, please create an issue.
统计信息
- 总下载量: 72
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-10