PHP code example of jenbuzz / laravel-uuid

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

    

jenbuzz / laravel-uuid example snippets




namespace App;

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

class MyModel extends Model
{
    use Uuid;
}




namespace App;

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

class MyModel extends Model
{
    use Uuid;

    protected $uuidVersion = 5;
    protected $uuidString = 'lorem';
    protected $uuidColumnName = 'my_uuid';
    protected $uuidGenerateOnSave = true;
}




$element = MyModel::findByUuid('3059dbe0-20d4-4591-9b02-1f77a1826544');