工单时间

This commit is contained in:
2025-08-20 15:24:36 +08:00
parent f83824c462
commit 08a7a10392
+18 -1
View File
@@ -47,10 +47,27 @@ class Ticket extends Model
* *
* @var bool * @var bool
*/ */
public $timestamps = true; public $timestamps = false;
protected $dateFormat = 'U'; protected $dateFormat = 'U';
/**
* 在保存时手动设置时间戳
*/
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->created_at = time();
$model->updated_at = time();
});
static::updating(function ($model) {
$model->updated_at = time();
});
}
/** /**
* 指定哪些字段自动转换为 Carbon 实例 * 指定哪些字段自动转换为 Carbon 实例
*/ */