BelongsTo('app\common\model\user\User', 'user_id', 'user_id'); } /** * 关联门店表 */ public function store() { return $this->BelongsTo('app\\common\\model\\store\\Store', 'store_id', 'store_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]; } /** * 类型 */ public function getTypeAttr($value) { $type = [0 => '普通店员', 20 => '门店管理员']; return ['text' => $type[$value], 'value' => $value]; } }