PHP code example of konstantinkoslow / laravel-uuid

1. Go to this page and download the library: Download konstantinkoslow/laravel-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/ */

    

konstantinkoslow / laravel-uuid example snippets


Schema::create('table_name', function (Blueprint $table) {
    $table->uuid('id');
    $table->primary('id');

    // or

    $table->char('key', 36)->primary();
});



namespace App;

use Illuminate\Database\Eloquent\Model;

class ModelName extends Model
{
    protected $primaryKey = 'key';
}



namespace App;

use Illuminate\Database\Eloquent\Model;
use KonstantinKoslow\LaravelUuid\UsesUuid;

class ModelName extends Model
{
    use UsesUuid;
}