getPk(); $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); }); } public function getFirstNumAttr($value, $data) { return isset($data['first_num']) ? $data['first_num'] : $data['num']; } public function getFirstPriceAttr($value, $data) { return isset($data['first_price']) ? $data['first_price'] : $data['price']; } public function getTypeList() { return ['1' => __('Type 1'), '2' => __('Type 2')]; } public function getTypeTextAttr($value, $data) { $value = $value ?: ($data['type'] ?? ''); $list = $this->getTypeList(); return $list[$value] ?? ''; } }