laravolt/eloquent-uuid

Universally Unique Identifier (UUID) for Laravel Eloquent
1,303 8
Install
composer require laravolt/eloquent-uuid
Latest Version:0.1.0
PHP:>=5.5.0
License:MIT
Last Updated:May 14, 2016
Links: GitHub  ·  Packagist
Maintainer: uyab

Universally Unique Identifier (UUID) for Laravel Eloquent

Generate UUID automatically when creating/inserting new data.

Install

Via Composer

$ composer require laravolt/eloquent-uuid

Then register the service provider, head over your config/app.php file and add the following line into the providers array:

Laravolt\Database\Eloquent\UuidServiceProvider::class,

Usage

Create/Alter Database Table Column Type

Schema::create('users', function (Blueprint $table) {
    
    // Create UUID column
    $table->char('id', 32)->primary();

    $table->string('name');
});

Implement in Eloquent Model

<?php

namespace App;

use Laravolt\Contracts\Eloquent\Uuid as UuidContract;
use Laravolt\Database\Eloquent\Uuid;

class Book extends Model implements UuidContract
{
    use Uuid;

    // Uuid Columns
    protected $uuid = ['id'];

Related Packages

eig/eloquent-uuid

Easy UUID for Eloquent Models

1,568 59
gbuckingham89/eloquent-uuid

A simple package for using UUID's (UUID4) with Laravel's Eloquent.

4,787 1
dyrynda/laravel-model-uuid

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

3,142,183 484
theprivateer/eloquent-uuid

UUID utility traits for Laravel

7,180 1
peach-schnapps/eloquent-uuid

Provides UUID Support for Laravel 4 Eloquent Models

6 2