initial commit

This commit is contained in:
2026-06-23 13:28:38 +07:00
commit 966ed115b2
590 changed files with 111412 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Traits;
use Illuminate\Support\Str;
trait UUID
{
protected static function boot ()
{
// Boot other traits on the Model
parent::boot();
/**
* Listen for the creating event on the user model.
* Sets the 'id' to a UUID using Str::uuid() on the instance being created
*/
static::creating(function ($model) {
if ($model->getKey() === null) {
$model->setAttribute($model->getKeyName(), Str::uuid()->toString());
}
});
}
// Tells the database not to auto-increment this field
public function getIncrementing ()
{
return false;
}
// Helps the application specify the field type in the database
public function getKeyType ()
{
return 'string';
}
}