Laravel model Trailing Data when save the model

前端 未结 6 813
青春惊慌失措
青春惊慌失措 2021-01-02 02:00

I have some code like this

    $editStuState = StuAtt::where(\'studentId\' , \'=\' , $id)->first();
    $editStuState -> leave +=1;
    $editStuState -         


        
6条回答
  •  情歌与酒
    2021-01-02 02:52

    If your Database is Postgres and your field is Timestamp sometimes Carbon cannot convert to default format (without milliseconds).

    If milliseconds is not needed, update field content to not have the millisecond part.

    UPDATE YOURTABLE SET created_at = date_trunc('seconds', created_at),
    updated_at = date_trunc('seconds', updated_at)
    

    This will normalize timestamped fields without milliseconds.

提交回复
热议问题