getPk(); $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); }); } public function getStatusList() { return ['normal' => __('Normal'), 'hidden' => __('Hidden')]; } public function getStateList() { return ['0' => __('State 0'), '1' => __('State 1')]; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public function getStateTextAttr($value, $data) { $value = $value ? $value : (isset($data['state']) ? $data['state'] : ''); $list = $this->getStateList(); return isset($list[$value]) ? $list[$value] : ''; } public function category() { return $this->belongsTo('app\admin\model\wanlshop\Category', 'category_id', 'id', [], 'LEFT')->setEagerlyType(0); } }