PHP code example of binarycabin / laravel-uuid

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

    

binarycabin / laravel-uuid example snippets




namespace App;

use BinaryCabin\LaravelUUID\Traits\HasUUID;
use Illuminate\Database\Eloquent\Model;

class Project extends Model
{

    use HasUUID;

}

protected $uuidFieldName = 'unique_id';

\App\Project::byUUID('uuid')->first();

\App\Project::findByUUID('uuid')



namespace App;

use BinaryCabin\LaravelUUID\Traits\HasUUID;
use BinaryCabin\LaravelUUID\Traits\UUIDIsPrimaryKey;
use Illuminate\Database\Eloquent\Model;

class Project extends Model
{

    use HasUUID, UUIDIsPrimaryKey;

}