__('App'), 'store' => __('Store')]; } public function getStatusList() { return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function store() { return $this->belongsTo('app\admin\model\Store', 'store_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function fetchServiceCategory($type, $store_id = null) { $where = [ "status" => \E_BASE_STATUS::Normal, "type" => $type, ]; if ($store_id) $where['store_id'] = $store_id; return $this->where($where) ->order("sort", "desc") ->limit(4) ->select(); } }