PHP code example of cloudcake / laravel-uuid

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

    

cloudcake / laravel-uuid example snippets


use Uuid\Traits\UuidPrimaryKey;

class User extends Authenticatable
{
    use UuidPrimaryKey;

    protected $primaryKey = 'id';
}

use Uuid\Traits\Uuid;

class User extends Authenticatable
{
    use Uuid;

    protected static $uuidKeyName = 'uuid';
}

use Uuid\Traits\Uuid;
use Illuminate\Database\Eloquent\Model;

class Comment extends Model
{
    use Uuid;

    /**
     * The name of the UUID column in the database.
     *
     * @var string
     */
    protected static $uuidKey = 'universally_unique_id';

    /**
     * Whether or not the UUID should use timestamp ordering.
     *
     * @var bool
     */
    protected static $uuidOrdered = true;
}