Initial PHP rebuild of the app
This commit is contained in:
690 files changed
+33944
-12046
No files matched your search
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Concerns;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
trait UsesStringIds
|
||||
{
|
||||
protected static function bootUsesStringIds(): void
|
||||
{
|
||||
static::creating(function ($model): void {
|
||||
if (! $model->getKey()) {
|
||||
$model->setAttribute($model->getKeyName(), Str::lower(Str::random(25)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getIncrementing(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getKeyType(): string
|
||||
{
|
||||
return 'string';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user