stevenmaguire/laravel-uuid-model

Create non-incrementing Laravel models whose primary key is a UUID
46 4
Install
composer require stevenmaguire/laravel-uuid-model
Latest Version:0.1.0
PHP:>=5.5.0
License:MIT
Last Updated:Oct 22, 2015
Links: GitHub  ·  Packagist
Maintainer: stevenmaguire

Laravel Uuid Model

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Create non-incrementing models whose primary key is a UUID.

Install

Via Composer

$ composer require stevenmaguire/laravel-uuid-model

Usage

Extend the UuidModel

class User extends Stevenmaguire\Laravel\UuidModel
{
    //
}

By default any model that extends the UuidModel will automatically assign a random UUID value to the primaryKey while creating.

To include custom "UUID attributes", each model that extends the UuidModel can declare those attributes as an array value for the uuidAttributes property.

class User extends Stevenmaguire\Laravel\UuidModel
{
    /**
     * Auto-assigned uuid model attributes.
     *
     * @var array
     */
    public $uuidAttributes = ['foo', 'bar'];
}

This will result in the model's primary key, id, foo, and bar all being automatically assigned a random UUID value.

Testing

$ ./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email stevenmaguire@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

eig/eloquent-uuid

Easy UUID for Eloquent Models

1,568 59
innoscience/eloquental

A rather clever model for Laravel's Eloquent ORM with self-validation, ordering,...

384 3
dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

3,142,183 484
stevenmaguire/laravel-cache

Seamlessly adding caching to Laravel service objects

1,758 17
gstjohn/eloquent-uuids

Easily allow Laravel Eloquent models to utilize UUIDs as their primary key.

6 0