2017 © Pedro Peláez
 

laravel-package laravel-model-uuid

Make usage of UUID in laravel models easy.

image

simlux/laravel-model-uuid

Make usage of UUID in laravel models easy.

  • Saturday, August 26, 2017
  • by simlux
  • Repository
  • 1 Watchers
  • 0 Stars
  • 116 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

Laravel Model UUID

Installation

composer require simlux/laravel-model-uuid:dev-master

Usage

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;
}

Migration

<?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');
    }
}

The Versions

26/08 2017

dev-master

9999999-dev

Make usage of UUID in laravel models easy.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Simon Kleeschulte

laravel php uuid