janyksteenbeek / laravel-uuidable
此包已被弃用,不再维护。未建议替代包。
为Laravel模型添加使用UUID作为标识符的功能
1.0
2022-05-05 23:12 UTC
Requires
- illuminate/database: ^7|^8|^9
- ramsey/uuid: ^4.3
This package is not auto-updated.
Last update: 2023-02-19 14:28:02 UTC
README
为Laravel模型添加使用UUID作为标识符的功能
安装
您可以使用Composer安装此包
composer require janyksteenbeek/laravel-uuidable
用法
将此包提供的特性应用于需要UUID作为主标识符的模型。
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Janyk\LaravelUuidable\Uuidable; class Post extends Model { use Uuidable, HasFactory; // ...
迁移
请注意,在使用UUID时,您需要更改数据库迁移。标识字段需要是一个类似于以下示例中的 uuid 字段
public function up() { Schema::create('posts', function (Blueprint $table) { $table->uuid('id')->primary(); // ...
许可
此包是开源的,根据LICENSE文件中的MIT许可证发布
安全漏洞
此包遵循Webmethod关于安全漏洞的责任披露指南。您可以在此处找到该政策。