Conditions | 2 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | 7 | protected static function boot(): void |
|
36 | { |
||
37 | 7 | parent::boot(); |
|
38 | |||
39 | static::creating(function (Model $model): void { |
||
40 | 4 | if (! $model->getKey()) { |
|
41 | 3 | $version = config('uuid.version'); |
|
42 | 3 | $namespace = config('uuid.namespace'); |
|
43 | 3 | $name = config('uuid.name'); |
|
44 | |||
45 | 3 | $model->{$model->getKeyName()} = Util::generateUuid($version, $namespace, $name)->toString(); |
|
46 | } |
||
50 |