dev-master
9999999-devUsing a UUID as PrimaryKey for laravel 5.3+
MIT
The Requires
- php >=5.4.0
- illuminate/support 5.*
- ramsey/uuid ~3.0
by Rack Lin
laravel postgres
Wallogit.com
2017 © Pedro Peláez
Using a UUID as PrimaryKey for laravel 5.3+
PkUuids package use ramsey/uuid[https://github.com/ramsey/uuid] (official installed on 5.3+) to generate a UUID_v4(random) as primary key for Eloquent Model., (*1)
inspired by http://stackoverflow.com/questions/31817067/laravel-5-using-a-uuid-as-primary-key, (*2)
composer require racklin/pkuuids:dev-master
Use a UUID as primary key, we need to change $table->increments('id'); to $table->uuid('id')->primary();, (*3)
Add $incrementing = false; to your Models., (*4)
Add use PkUuuids; to your Models., (*5)
Example:, (*6)
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Racklin\PkUuids\PkUuids;
class User extends Model
{
use PkUuids;
$incrementing = false;
}
Current package version works for Laravel 5.3+., (*7)
Using a UUID as PrimaryKey for laravel 5.3+
MIT
laravel postgres