brokeyourbike / uid-keys
为Eloquent模型的ID提供UUID和ULID支持的简单即插即用解决方案。
资助包维护!
brokeyourbike
Open Collective
0.1.1
2023-05-14 21:15 UTC
Requires
- php: ^8.1
- laravel/framework: ^8.0|^9.0
- symfony/uid: ^6.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.4
- orchestra/testbench: ^6
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-20 14:35:22 UTC
README
为Eloquent模型的ID提供UUID和ULID支持的简单即插即用解决方案。
安装
composer require brokeyourbike/uid-keys
使用
use Illuminate\Database\Eloquent\Model; use BrokeYourBike\UidKeys\Database\Eloquent\Ulid; class ExampleModel extends Model { use Ulid; /** * The "type" of the auto-incrementing ID. * * @var string */ protected $keyType = 'string'; /** * Indicates if the IDs are auto-incrementing. * * @var bool */ public $incrementing = false; }
灵感来源
代码主要借鉴自goldspecdigital/laravel-eloquent-uuid 包。
作者
- Ivan Stasiuk | Twitter | LinkedIn | stasi.uk