[更新] 时间格式

This commit is contained in:
2021-02-01 21:49:48 +08:00
parent ea4aab991d
commit 033da12403
3 changed files with 13 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Schema;
@@ -59,4 +60,14 @@ class Log extends Model
}
/**
* 为数组 / JSON 序列化准备日期。
* @param \DateTimeInterface $date
* @return string
*/
protected function serializeDate(DateTimeInterface $date)
{
return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
}
}