protected $autoWriteTimestamp = true;
protected $readonly = [ // 只读字段
// 'create_time',
];
控制器
$user = User::find(1);
$user->state = 1;
// $user->create_time = 11;
$user->force()->save();
在未定义只读字段或者设置create_time字段更新,通过模型更新会提示
#0 [10501]PDOException in PDOConnection.php line 768
SQLSTATE[01000]: Warning: 1265 Data truncated for column 'create_time' at row 1
不解? 求大佬指点一二,之前用tp5没有这个问题
最佳答案
