__('Decorate_type 1'), '2' => __('Decorate_type 2'), '3' => __('Decorate_type 3'), '4' => __('Decorate_type 4')]; } public function getIsUsingList() { return ['1' => __('Is_using 1'), '0' => __('Is_using 0')]; } public function getDecorateTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['decorate_type']) ? $data['decorate_type'] : ''); $list = $this->getDecorateTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getIsUsingTextAttr($value, $data) { $value = $value ? $value : (isset($data['is_using']) ? $data['is_using'] : ''); $list = $this->getIsUsingList(); return isset($list[$value]) ? $list[$value] : ''; } public function getEndTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setEndTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function decorate() { return $this->belongsTo('Decorate', 'decorate_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function user() { return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } }