AdminUser.php 1.1 KB
Newer Older
init  
孙建华 已提交
1 2 3 4 5 6 7 8 9 10 11
<?php
/**
 * Date: 2019/2/25 Time: 10:34
 *
 * @author  Eddy <cumtsjh@163.com>
 * @version v1.0.0
 */

namespace App\Model\Admin;

use Illuminate\Foundation\Auth\User as Authenticatable;
孙建华 已提交
12
use Spatie\Permission\Traits\HasRoles;
init  
孙建华 已提交
13 14 15

class AdminUser extends Authenticatable
{
孙建华 已提交
16 17
    use HasRoles;

18 19 20 21
    const STATUS_ENABLE = 1;
    const STATUS_DISABLE = 0;

    protected $guarded = [];
孙建华 已提交
22 23

    protected $guard_name = 'admin';
孙建华 已提交
24

25 26 27
    public static $searchField = [
        'name' => '用户名',
        'status' => [
28
            'showType' => 'select',
29 30 31 32 33 34 35
            'searchType' => '=',
            'title' => '状态',
            'enums' => [
                0 => '禁用',
                1 => '启用',
            ],
        ],
36 37 38 39
        'created_at' => [
            'showType' => 'datetime',
            'title' => '创建时间'
        ]
40 41
    ];

42 43 44 45 46 47
    public static $listField = [
        'name' => '用户名',
        'statusText' => '状态',
        'roleNames' => '角色',
    ];

孙建华 已提交
48 49 50 51
    public function comments()
    {
        return $this->hasMany('App\Model\Admin\Comment', 'user_id');
    }
孙建华 已提交
52
}