toDateTimeString(); } /** * updated_at_format * * @comment 更新时间的格式化 * @return string */ public function getUpdatedAtFormatAttribute(): string { return $this[self::UPDATED_AT]->toDateTimeString(); } /** * 为数组 / JSON 序列化准备日期。 */ protected function serializeDate(DateTimeInterface $date): string { return $date->format($this->dateFormat ?: 'Y-m-d H:i:s'); } }