UuidModel   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 1
1
<?php
2
3
namespace FaithGen\SDK\Models;
4
5
use FaithGen\SDK\Traits\ExcludesColumns;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Support\Str;
8
9
class UuidModel extends Model
10
{
11
    use ExcludesColumns;
12
13
    public $incrementing = false;
14
    protected $guarded = [
15
        'id',
16
    ];
17
18
    protected static function boot()
19
    {
20
        parent::boot();
21
        self::creating(function ($user) {
22
            $user->id = str_shuffle((string) Str::uuid());
23
        });
24
    }
25
}
26