链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

40 lines
1.3 KiB

<?php
namespace App\Models\v3;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
class StoreUser extends Model
{
use HasDateTimeFormatter;
use SoftDeletes;
protected $table = 'lanzu_store_users';
protected $dateFormat = 'U';
protected $appends = [
'user_category_text',
'register_type_text',
'status_text'
];
public static $_USER_CATEGORY = ['管理员','店长', 2=>'店员'];
public static $_REGISTER_TYPE = ['网站注册','QQ','微信','app','商户注册默认账号','后台添加商户账号'];
public static $_STATUS = ['禁用','审核中', '正常'];
public function getUserCategoryTextAttribute($value)
{
$value = $value ? $value : $this->user_category;
return isset(self::$_USER_CATEGORY[$value]) ? self::$_USER_CATEGORY[$value] : '';
}
public function getRegisterTypeTextAttribute($value)
{
$value = $value ? $value : $this->register_type;
return isset(self::$_REGISTER_TYPE[$value]) ? self::$_REGISTER_TYPE[$value] : '';
}
public function getStatusTextAttribute($value)
{
$value = $value ? $value : $this->status;
return isset(self::$_STATUS[$value]) ? self::$_STATUS[$value] : '';
}
}