Files
backend/app/Models/Concerns/HasUuid.php
T
2026-06-28 12:29:53 +02:00

18 lines
311 B
PHP

<?php
namespace App\Models\Concerns;
use Illuminate\Support\Str;
trait HasUuid
{
protected static function bootHasUuid(): void
{
static::creating(function ($model) {
if (empty($model->uuid)) {
$model->uuid = (string) Str::uuid();
}
});
}
}