getPk(); $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); }); } public function getIsWifiList() { return ['1' => __('Is_wifi 1'), '0' => __('Is_wifi 0')]; } public function getWindowList() { return ['1' => __('Window 1'), '0' => __('Window 0')]; } public function getBreakfastList() { return ['1' => __('Breakfast 1'), '0' => __('Breakfast 0')]; } public function getStatusList() { return ['1' => __('Status 1'), '0' => __('Status 0')]; } public function getIsWifiTextAttr($value, $data) { $value = $value ? $value : (isset($data['is_wifi']) ? $data['is_wifi'] : ''); $list = $this->getIsWifiList(); return isset($list[$value]) ? $list[$value] : ''; } public function getWindowTextAttr($value, $data) { $value = $value ? $value : (isset($data['window']) ? $data['window'] : ''); $list = $this->getWindowList(); return isset($list[$value]) ? $list[$value] : ''; } public function getBreakfastTextAttr($value, $data) { $value = $value ? $value : (isset($data['breakfast']) ? $data['breakfast'] : ''); $list = $this->getBreakfastList(); 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 getCreateTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getUpdateTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setCreateTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } protected function setUpdateTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function hotel() { return $this->belongsTo('Hotel', 'hotel_id', 'id', [], 'LEFT')->setEagerlyType(0); } }