laravel临时关闭created_at、updated_at的自动更新。
直接上代码
$user = new User([
'id' => 1,
'name' => 'xiyoudaodao',
'password' => Hash::make('admin'),
'login' => 'admin'
]);
$user->timestamps = false;
$nowTimeUnix = time();
$user->created_at = date("Y-m-d H:i:s", $nowTimeUnix + 10);
$user->updated_at = date("Y-m-d H:i:s", $nowTimeUnix + 10);
$user->save();
个人博客:西柚叨叨的个人博客