megahunt.test/app/UuidId.php

21 lines
388 B
PHP
Raw Normal View History

2024-08-29 11:48:10 +02:00
<?php
namespace App;
use Ramsey\Uuid\Uuid;
trait UuidId
{
protected static function boot() {
parent::boot();
static::creating(function ($model) {
$model->id = Uuid::uuid6()->toString();
});
}
public function getIncrementing(): bool {
return false;
}
public function getKeyType(): string {
return 'string';
}
}