chore: remove APAW from tracking; gitignore agent-generated files
This commit is contained in:
27
app/Traits/UsesUuid.php
Normal file
27
app/Traits/UsesUuid.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait UsesUuid
|
||||
{
|
||||
protected static function bootUsesUuid()
|
||||
{
|
||||
static::creating(function ($model) {
|
||||
if (! $model->getKey()) {
|
||||
$model->{$model->getKeyName()} = (string) Str::uuid();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getIncrementing()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getKeyType()
|
||||
{
|
||||
return 'string';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user