| Total Complexity | 4 | 
| Total Lines | 35 | 
| Duplicated Lines | 0 % | 
| Coverage | 0% | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 7 | trait HasUUID  | 
            ||
| 8 | { | 
            ||
| 9 | /**  | 
            ||
| 10 | * Boot model class.  | 
            ||
| 11 | */  | 
            ||
| 12 | protected static function bootHasUUID()  | 
            ||
| 13 |     { | 
            ||
| 14 |         static::creating(function ($model) { | 
            ||
| 15 | /*  | 
            ||
| 16 | * @var \Illuminate\Database\Eloquent\Model  | 
            ||
| 17 | */  | 
            ||
| 18 |             if (! $model->getKey()) { | 
            ||
| 19 |                 $model->{$model->getKeyName()} = Str::uuid()->toString(); | 
            ||
| 20 | }  | 
            ||
| 21 | });  | 
            ||
| 22 | }  | 
            ||
| 23 | |||
| 24 | /**  | 
            ||
| 25 | * Do not increment primary key.  | 
            ||
| 26 | *  | 
            ||
| 27 | * @return bool  | 
            ||
| 28 | */  | 
            ||
| 29 | public function getIncrementing()  | 
            ||
| 30 |     { | 
            ||
| 31 | return false;  | 
            ||
| 32 | }  | 
            ||
| 33 | |||
| 34 | /**  | 
            ||
| 35 | * Return primary key type.  | 
            ||
| 36 | *  | 
            ||
| 37 | * @return string  | 
            ||
| 38 | */  | 
            ||
| 39 | public function getKeyType()  | 
            ||
| 42 | }  | 
            ||
| 43 | }  | 
            ||
| 44 |