Skip to content

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

License

Notifications You must be signed in to change notification settings

brokeyourbike/uid-keys-laravel

Repository files navigation

uid-keys

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