PHP code example of frictionlessdigital / uuidable

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

    

frictionlessdigital / uuidable example snippets


use Fls\Uuidable\Uuidable;

class User extends Model
{
    use Uuidable;
    ...
}

use Fls\Uuidable\Uuidable;

class User extends Model
{
    use Uuidable;
    ...

    /**
     * Name of the field to to store the UUID
     *
     * @var string
     */
    const UUID = 'diuu';
}

$user  = User::findByUuid(string $uuid);

$user  = User::findByUuid(string $uuid, ['email', 'password']);

$builder  = User::whereUuid(string $uuid);

$builder  = User::whereUuid([$uuid]);

$builder  = User::whereUuid(collect([$uuid]));

$builder  = User::whereUuid(Users::pluck('uuid'));