EntityField   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A entity() 0 3 1
1
<?php
2
/**
3
 * @author  Eddy <[email protected]>
4
 */
5
6
namespace App\Model\Admin;
7
8
class EntityField extends Model
9
{
10
    const SHOW_ENABLE = 1;
11
    const SHOW_DISABLE = 0;
12
13
    const SHOW_INLINE = 1;
14
    const SHOW_NOT_INLINE = 0;
15
16
    const EDIT_ENABLE = 1;
17
    const EDIT_DISABLE = 0;
18
19
    const REQUIRED_ENABLE = 1;
20
    const REQUIRED_DISABLE = 0;
21
22
    protected $guarded = [];
23
24
    public function entity()
25
    {
26
        return $this->belongsTo('App\Model\Admin\Entity', 'entity_id');
27
    }
28
29
    public static $listField = [
30
        'entityName' => '模型',
31
        'name' => '字段名称',
32
        'type' => '字段类型',
33
        'form_name' => '表单名称',
34
        'form_type' => ['title' => '表单类型', 'sort' => true],
35
        'is_show_inline' => [
36
            'title' => '行内展示', 'sort' => true, 'templet' => '#isShowInlineTemplet', 'event' => 'showInlineEvent'
37
        ],
38
        'is_show' => ['title' => '显示', 'templet' => '#isShowTemplet', 'event' => 'showEvent'],
39
        'order' => ['title' => '排序', 'sort' => true, 'edit' => true, 'width' => 80],
40
    ];
41
42
    public static $searchField = [
43
        'name' => '字段名称',
44
        'entity_id' => [
45
            'title' => '模型',
46
            'searchType' => '=',
47
            'showType' => 'select',
48
            'enums' => [],
49
        ]
50
    ];
51
}
52