2017 © Pedro Peláez
 

library laravel-uuid

A wrapper for webpatser/laravel-uuid with additional integration

image

binarycabin/laravel-uuid

A wrapper for webpatser/laravel-uuid with additional integration

  • Tuesday, November 21, 2017
  • by binarycabin
  • Repository
  • 1 Watchers
  • 3 Stars
  • 151 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 76 % Grown

The README.md

Laravel-UUID

Build Status StyleCI Latest Stable Version Total Downloads, (*1)

A wrapper for webpatser/laravel-uuid with additional integration, (*2)

composer require binarycabin/laravel-uuid

This package adds a very simple trait to automatically generate a UUID for your Models., (*3)

Simply add the "\BinaryCabin\LaravelUUID\Traits\HasUUID;" trait to your model:, (*4)

<?php

namespace App;

use BinaryCabin\LaravelUUID\Traits\HasUUID;
use Illuminate\Database\Eloquent\Model;

class Project extends Model
{

    use HasUUID;

}

If your column name is not "uuid", simply add a new property to your model named "uuidFieldName":, (*5)

protected $uuidFieldName = 'unique_id';

This trait also adds a scope:, (*6)

\App\Project::byUUID('uuid')->first();

And static find method:, (*7)

\App\Project::findByUUID('uuid')

A second trait is available if you use your UUIDs as primary keys:, (*8)

<?php

namespace App;

use BinaryCabin\LaravelUUID\Traits\HasUUID;
use BinaryCabin\LaravelUUID\Traits\UUIDIsPrimaryKey;
use Illuminate\Database\Eloquent\Model;

class Project extends Model
{

    use HasUUID, UUIDIsPrimaryKey;

}

It simply tells Laravel that your primary key isn't an auto-incrementing integer, so it will treat the value correctly., (*9)

The Versions

21/11 2017

dev-master

9999999-dev

A wrapper for webpatser/laravel-uuid with additional integration

  Sources   Download

MIT

The Requires

 

14/11 2017

1.0.1

1.0.1.0

A wrapper for webpatser/laravel-uuid with additional integration

  Sources   Download

MIT

The Requires

 

14/11 2017

1.0.0

1.0.0.0

A wrapper for webpatser/laravel-uuid with additional integration

  Sources   Download

MIT

The Requires