1. Go to this page and download the library: Download ratno/laravel-eloquent-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/ */
ratno / laravel-eloquent-uuid example snippets
use Illuminate\Database\Eloquent\Model;
use App\Models\Concerns\UsesUUID;
class Post extends Model
{
use UsesUUID;
}
use Illuminate\Database\Eloquent\Model;
use App\Models\Concerns\UsesUUID;
class Post extends Model
{
use UsesUUID;
protected $uuidName = 'token';
}
use Illuminate\Database\Eloquent\Model;
use App\Models\Concerns\UsesUUID;
class Post extends Model
{
use UsesUUID;
public $incrementing = false;
protected $keyType = 'string';
public function getUuidName(): string
{
return $this->getKeyName();
}
}
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
Schema::create('posts', function (Blueprint $table) {
// ...
$table->uuid('uuid')->unique();
// ...
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.