EntityField::entity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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