vistag/eloquent-uuid

Eloquent models UUID traits

dev-master 2018-02-06 16:21 UTC

This package is not auto-updated.

Last update: 2024-12-15 09:01:25 UTC


README

Laravel package with Eloquent models UUID1 and UUID4 traits that will let you generate UUIDs for your Eloquent models automatically.

Installation

You can install this package via composer using this command:

 composer require vistag/eloquent-uuid

Usage

Models

To set up a model to use UUID, simply use HasUuid1 or HasUuid4 trait.

UUID1 Example

use Illuminate\Database\Eloquent\Model;
use Vistag\EloquentUuid\HasUuid1;

class Item extends Model
{
  use HasUuid1;
  
  ....
  
}

UUID4 Example

use Illuminate\Database\Eloquent\Model;
use Vistag\EloquentUuid\HasUuid4;

class Item extends Model
{
  use HasUuid4;
  
  ....
  
}

Support

If you believe you have found an issue, please report it using the GitHub issue tracker, or better yet, fork the repository and submit a pull request.

If you're using this package, I'd love to hear your thoughts. Thanks!

License

The MIT License (MIT). Vistag.com