| Conditions | 2 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | protected static function boot() |
||
| 14 | { |
||
| 15 | parent::boot(); |
||
| 16 | static::creating(function ($model) { |
||
| 17 | $model->{config('uuid.default_uuid_column')} = UUIDManager::generate(); |
||
| 18 | }); |
||
| 19 | static::saving(function ($model) { |
||
| 20 | $original_uuid = $model->getOriginal(config('uuid.default_uuid_column')); |
||
| 21 | if ($original_uuid !== $model->{config('uuid.default_uuid_column')}) { |
||
| 22 | $model->{config('uuid.default_uuid_column')} = $original_uuid; |
||
| 23 | } |
||
| 24 | }); |
||
| 25 | } |
||
| 26 | |||
| 46 | } |