PHP code example of minusmillionaer / eloquent-uuid

1. Go to this page and download the library: Download minusmillionaer/eloquent-uuid library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

minusmillionaer / eloquent-uuid example snippets



    // ...
    Schema::create('users', function (Blueprint $table) {
        $table->uuid('id'); // this will create a CHAR(36) field
        // or
        // $table->char('id', 36);
        $table->string('username', 32);
        $table->string('password', 50);
        // ...
        $table->primary('id');
    });


    // ...
    Schema::create('users', function (Blueprint $table) {
        $table->char('id', 32);
        // ...
        $table->string('username', 32);
        $table->string('password', 50);

        $table->primary('id');
    });



    // ...
    Schema::create('users', function (Blueprint $table) {
        $table->string('username', 32);
        $table->string('password', 50);
    });

    DB::statement('ALTER TABLE `usersb` ADD `id` BINARY(16); ALTER TABLE `usersb` ADD PRIMARY KEY (`id`);')



namespace App;
use NETZFABRIK\Uuid\Uuid[32|Binary]ModelTrait;

class User extends Eloquent
{
    use Uuid[32|Binary]ModelTrait;
}