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 ($this->id == 18) { // 执行格式化操作 return array_values(json_decode($extra, true) ?: []); } else { // 不执行格式化操作 return $extra; } } public function setValueAttribute($extra) { if ($this->id == 18) { // 执行格式化操作 return $this->attributes['value'] = json_encode(array_values($extra)); } return $this->attributes['value'] = $extra; } }