format('Y-m-d H:i:s'); return $formattedTime; } public function getUpdatedAtAttribute($value) { $dateTime = new \DateTime($value); // 格式化时间 $formattedTime = $dateTime->format('Y-m-d H:i:s'); return $formattedTime; } public function getValueAttribute($extra) { if (18 == $this->id) { // 执行格式化操作 return array_values(json_decode($extra, true) ?: []); } // 不执行格式化操作 return $extra; } public function setValueAttribute($extra) { if (18 == $this->id) { // 执行格式化操作 return $this->attributes['value'] = json_encode(array_values($extra)); } return $this->attributes['value'] = $extra; } }