Eloquent model not updating updated_at timestamp

后端 未结 5 659
無奈伤痛
無奈伤痛 2021-02-12 14:52

I\'m using Laravel 5.1. To make it simple, I have the following code

Migration:

Schema::create(\'sitemap_data\', function (Blueprint $table) {
    // Pri         


        
5条回答
  •  礼貌的吻别
    2021-02-12 15:01

    This is not the case in the question, but same issue will happen if you're using Query Builder instead of Eloquent Model.

    If you do

    DB::table('users')->where()->update()
    

    instead of

    User::where()->update()
    

    updated_at will not be updated.

提交回复
热议问题