stayallive / laravel-eloquent-uuid
为Laravel Eloquent模型属性生成UUID。
v1.0.3
2024-03-13 21:32 UTC
Requires
- php: ^8.0.2
- laravel/framework: ^9|^10|^11
- ramsey/uuid: ^4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.15
- orchestra/testbench: ^8|^9
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2024-09-13 22:32:23 UTC
README
为Laravel Eloquent模型属性生成UUID。
注意 这个包仍然表现得很好,但是从Laravel 10开始,这个包不再需要,因为Laravel现在内置了UUID/ULID特性,它们与这个包的功能非常相似。更多关于UUID/ULID的信息请参阅Laravel文档。
安装
composer require stayallive/laravel-eloquent-uuid
使用
添加UsesUUID
特性将确保键属性将被填充为UUID。
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Stayallive\Laravel\Eloquent\UUID\UsesUUID; class SomeModel extends Model { use UsesUUID; /** * This method is not needed but can be used to override which attribute is filled with the UUID. */ public function getUUIDAttributeName(): string { return $this->getKeyName(); } }
安全漏洞
如果您在这个包中发现安全漏洞,请向Alex Bouma发送电子邮件至alex+security@bouma.me
。所有安全漏洞都将得到迅速处理。
许可协议
此包是开源软件,许可协议为MIT许可协议。