<?php
|
|
|
namespace app\common\model\user;
|
|
use app\common\model\BaseModel;
|
|
/**
|
* 平台核销员模型
|
*/
|
class Clerk extends BaseModel
|
{
|
protected $pk = 'clerk_id';
|
protected $name = 'user_clerk';
|
|
/**
|
* 关联用户表
|
*/
|
public function user()
|
{
|
return $this->BelongsTo('app\common\model\user\User', 'user_id', 'user_id');
|
}
|
|
/**
|
* 核销员详情
|
*/
|
public static function detail($where, $with = ['user'])
|
{
|
$filter = is_array($where) ? $where : ['clerk_id' => $where];
|
return (new static())->with($with)->where(array_merge(['is_delete' => 0], $filter))->find();
|
}
|
|
/**
|
* 状态
|
*/
|
public function getStatusAttr($value)
|
{
|
$status = [0 => '禁用', 1 => '启用'];
|
return ['text' => $status[$value], 'value' => $value];
|
}
|
|
}
|