brokeyourbike/uid-keys

A simple drop-in solution for providing UUID and ULID support for the IDs of your Eloquent models.

0.1.1 2023-05-14 21:15 UTC

This package is auto-updated.

Last update: 2024-03-20 13:23:52 UTC


README

Latest Stable Version Total Downloads Maintainability Test Coverage

A simple drop-in solution for providing UUID and ULID support for the IDs of your Eloquent models.

Installation

composer require brokeyourbike/uid-keys

Usage

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;
}

Inspiration

Code mainly stolen from the goldspecdigital/laravel-eloquent-uuid package.

Authors

License

Mozilla Public License v2.0