Comment   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A replyUser() 0 3 1
A entity() 0 3 1
A user() 0 3 1
1
<?php
2
/**
3
 * @author  Eddy <[email protected]>
4
 */
5
6
namespace App\Model\Admin;
7
8
class Comment extends Model
9
{
10
    public static $listField = [
11
        'pid' => ['title' => '父ID', 'width' => 80],
12
        'entityName' => ['title' => '模型', 'width' => 100],
13
        'userName' => ['title' => '用户名', 'width' => 100],
14
        'content' => ['title' => '内容', 'width' => 400],
15
        'reply_count' => ['title' => '回复数', 'width' => 80, 'sort' => true],
16
        'like' => ['title' => '喜欢', 'width' => 80, 'sort' => true],
17
        'dislike' => ['title' => '不喜欢', 'width' => 80, 'sort' => true],
18
    ];
19
20
    public static $searchField = [
21
        'content' => '内容',
22
    ];
23
24
    const STATUS_ENABLE = 1;
25
    const STATUS_DISABLE = 0;
26
27
    const ADMIN_YES = 1;
28
    const ADMIN_NO = 0;
29
30
    protected $guarded = [];
31
32
    public function user()
33
    {
34
        return $this->belongsTo('App\Model\Admin\User', 'user_id');
35
    }
36
37
    public function replyUser()
38
    {
39
        return $this->belongsTo('App\Model\Admin\User', 'reply_user_id');
40
    }
41
42
    public function entity()
43
    {
44
        return $this->belongsTo('App\Model\Admin\Entity', 'entity_id');
45
    }
46
}
47