DynamicUnit   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A items() 0 3 1
1
<?php
2
3
namespace SimpleCMS\DynamicUnit\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Factories\HasFactory;
7
8
/**
9
 * DynamicUnit
10
 * 
11
 * @property int $id 主键
12
 * @property string $name 名称
13
 * @property ?string $code 标识
14
 * @property-read ?\Illuminate\Database\Eloquent\Collection<DynamicAttribute> $items 属性值
15
 * @property-read \Carbon\Carbon $created_at 创建时间
16
 * @property-read ?\Carbon\Carbon $updated_at 更新时间
17
 */
18
class DynamicUnit extends Model
19
{
20
    use HasFactory;
21
    
22
    protected $fillable = [
23
        'name',
24
        'code',
25
    ];
26
27
    public $casts = [
28
        'created_at' => 'datetime',
29
        'updated_at' => 'datetime'
30
    ];
31
32
    /**
33
     * 属性值
34
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
35
     */
36
    public function items()
37
    {
38
        return $this->hasMany(DynamicAttribute::class);
39
    }
40
}
41