A simple package to use universally unique identifiers (UUID) in Eloquent models.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.editorconfig
.gitignore
LICENSE
README.md
composer.json
composer.lock
phpunit.xml

README.md

Eloquent UUID

A simple package to use universally unique identifiers (UUID) as primary key of the Eloquent models.

This package uses Uuid library utilized in Laravel Framework to generate UUIDs.

Installation

composer require edersoares/eloquent-uuid

Usage

  • Replace in migrations files:
// From
$table->increments('id');

// To
$table->uuid('uuid')->unique();
$table->primary('uuid')
  • After, use in your model the Nix\Eloquent\Uuid\Uuid trait:
use Illuminate\Database\Eloquent\Model;
use Nix\Eloquent\Uuid\Uuid;

class SomeModel extends Model
{
    use Uuid;
}

Credits

This package uses:

And is based on: