first commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait HasUuid
|
||||
{
|
||||
public static function bootHasUuid(): void
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (!$model->uuid) {
|
||||
$model->uuid = Str::uuid()->toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user