__('Status 1'), '0' => __('Status 0')]; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getExplainingList() { return ['1' => __('Explaining 1'), '0' => __('Explaining 0')]; } public function getExplainingTextAttr($value, $data) { $value = $value ? $value : (isset($data['explaining']) ? $data['explaining'] : ''); $list = $this->getExplainingList(); return isset($list[$value]) ? $list[$value] : ''; } public function getSelloutList() { return ['1' => __('Sellout 1'), '0' => __('Sellout 0')]; } public function getSelloutTextAttr($value, $data) { $value = $value ? $value : (isset($data['sellout']) ? $data['sellout'] : ''); $list = $this->getSelloutList(); return isset($list[$value]) ? $list[$value] : ''; } public function course() { return $this->belongsTo('app\admin\model\Course', 'live_id', 'id', [], 'LEFT')->setEagerlyType(0); } /** * 查询指定商品 * @param [type] $query * @param [type] $goods * @return void */ public function scopeNormal($query) { return $query->where([ 'status'=>1, 'sellout'=>0 ]); } /** * 查询指定商品 * @param [type] $query * @param [type] $goods * @return void */ public function scopeSort($query) { return $query->order('explaining DESC, id ASC'); } }