<?php

namespace App\Models;

use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @description 用户管理
 * @author  system;
 * @version    1.0
 * @date 2018-05-14 13:25:12
 *
 */
class AlbumUserModel extends Authenticatable
{
    use  HasApiTokens, Notifiable, SoftDeletes;
    /**
     * 数据表名
     *
     * @var string
     *
     */
    protected $table = 'album_user';
    /**
     * 主键
     */
    protected $primaryKey = 'id';

    //分页
    protected $perPage = PAGE_NUMS;

    /**
     * 可以被集体附值的表的字段
     *
     * @var string
     */
    protected $fillable = [
        'username',
        'wechat_open_id',
        'open_id',
        'wechat_union_id',
        'avatar',
        'store_id',
        'is_dealer',
        'phone',
        'role'
    ];

    public function role(){
        switch ($this->role){
            case 1:
                return '生产部';
                break;
            case 2:
                return '包装部';
                break;
            case 3:
                return '经理';
                break;
            default:
                return '普通用户';
                break;
        }
    }


}