PHP code example of adnane / simple-uuid

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

    

adnane / simple-uuid example snippets


'aliases' => [
    ..
    'SimpleUuid' => Adnane\SimpleUuid\Traits\SimpleUuid::class,

use Adnane\SimpleUuid\Traits\SimpleUuid;

# or if using an alias 

use SimpleUuid;
 
use Adnane\SimpleUuid\Traits\SimpleUuid;

class User extends Model
{
    use HasFactory ,SimpleUuid;
 
Schema::create('users', function (Blueprint $table) {
    $table->uuid('id')->primary();
    ..         
 
php artisan migrate 
 
# comments_table
$table->uuid('user_id')->index();
$table->foreign('user_id')->references('id')->on('users');