跟进时间
This commit is contained in:
@@ -36,11 +36,22 @@ class Follow extends Model
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = true;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $casts = [
|
||||
'follow_time' => 'timestamp', // 指定序列化格式
|
||||
'updated_at' => 'timestamp', // 指定序列化格式
|
||||
'created_at' => 'timestamp', // 指定序列化格式
|
||||
];
|
||||
/**
|
||||
* 在保存时手动设置时间戳
|
||||
*/
|
||||
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();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user