Passed
Push — master ( 537546...f6872a )
by Jianhua
06:02 queued 15s
created

AdminUser::comments()   A

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
 * Date: 2019/2/25 Time: 10:34
4
 *
5
 * @author  Eddy <[email protected]>
6
 * @version v1.0.0
7
 */
8
9
namespace App\Model\Admin;
10
11
use Illuminate\Foundation\Auth\User as Authenticatable;
12
use Spatie\Permission\Traits\HasRoles;
13
14
class AdminUser extends Authenticatable
15
{
16
    use HasRoles;
0 ignored issues
show
introduced by
The trait Spatie\Permission\Traits\HasRoles requires some properties which are not provided by App\Model\Admin\AdminUser: $name, $map, $permissions, $roles
Loading history...
17
18
    const STATUS_ENABLE = 1;
19
    const STATUS_DISABLE = 0;
20
21
    protected $guarded = [];
22
23
    protected $guard_name = 'admin';
24
25
    public static $searchField = [
26
        'name' => '用户名',
27
        'status' => [
28
            'showType' => 'select',
29
            'searchType' => '=',
30
            'title' => '状态',
31
            'enums' => [
32
                0 => '禁用',
33
                1 => '启用',
34
            ],
35
        ],
36
        'created_at' => [
37
            'showType' => 'datetime',
38
            'title' => '创建时间'
39
        ]
40
    ];
41
42
    public static $listField = [
43
        'name' => '用户名',
44
        'statusText' => '状态',
45
        'roleNames' => '角色',
46
    ];
47
48
    public function comments()
49
    {
50
        return $this->hasMany('App\Model\Admin\Comment', 'user_id');
51
    }
52
}
53