kduma/eloquent-ulidable
最新稳定版本:v3.0.0
Composer 安装命令:
composer require kduma/eloquent-ulidable
包简介
Eloquent Ulidable Trait
关键字:
README 文档
README
Eloquent trait that adds a ULID as an additional column alongside the numeric id in Laravel models.
Full documentation: opensource.duma.sh/libraries/php/eloquent-ulidable
Requirements
- PHP
^8.3 - Laravel
^13.0
Installation
composer require kduma/eloquent-ulidable
Usage
use KDuma\Eloquent\Ulidable; use KDuma\Eloquent\Attributes\HasUlid; #[HasUlid(field: 'ulid')] class Post extends Model { use Ulidable; }
Add a ulid column to your migration:
$table->ulid()->unique();
ULID is auto-generated on create. Find by ULID with Post::whereUlid($ulid) or Post::byUlid($ulid).
Unlike Laravel's built-in
HasUlids, this package keeps the numericidas the primary key and stores the ULID in a separate column.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-26