dev-master
9999999-devMake usage of UUID in laravel models easy.
MIT
The Requires
- php ^7.0
- illuminate/database ^5.4
- ramsey/uuid ^3.7
The Development Requires
by Simon Kleeschulte
laravel php uuid
Wallogit.com
2017 © Pedro Peláez
Make usage of UUID in laravel models easy.
composer require simlux/laravel-model-uuid:dev-master
Creates column uuid and unique index with the migration helper., (*1)
<?php
use Illuminate\Database\Eloquent\Model;
use Simlux\LaravelModelUuid\Uuid\UuidModelTrait;
/**
* Class MyModel
*
* @property int $id
* @property string $uuid
*
* @method static MyModel uuid(string $uuid)
*/
class MyModel extends Model
{
use UuidModelTrait;
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Simlux\LaravelModelUuid\Migration\UuidMigrationHelper;
class CreateTableRevisions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('my_models', function (Blueprint $table) {
$table->unsignedBigInteger('id', true);
UuidMigrationHelper::uuid($table);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('my_models');
}
}
Make usage of UUID in laravel models easy.
MIT
laravel php uuid