Category   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 27
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A parent() 0 3 1
A entity() 0 3 1
A children() 0 3 1
1
<?php
2
/**
3
 * @author  Eddy <[email protected]>
4
 */
5
6
namespace App\Model\Admin;
7
8
class Category extends Model
9
{
10
    protected $guarded = [];
11
12
    public static $searchField = [
13
        'name' => '名称',
14
    ];
15
16
    public static $listField = [
17
        'parentName' => '上级分类',
18
        'entityName' => '关联模型',
19
        'order' => '排序',
20
    ];
21
22
    public function parent()
23
    {
24
        return $this->belongsTo('App\Model\Admin\Category', 'pid');
25
    }
26
27
    public function children()
28
    {
29
        return $this->hasMany('App\Model\Admin\Category', 'pid');
30
    }
31
32
    public function entity()
33
    {
34
        return $this->belongsTo('App\Model\Admin\Entity', 'model_id');
35
    }
36
}
37