<?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'; } }