Eloquent model not updating updated_at timestamp

As mentioned in comments, if the model did not change the timestamps wont be updated. However if you need to update them, or want to check if everything is working fine use $model->touch() - more here


Yeah what Musterknabe has done is correct but he should also check his model SitemapData.php it should have to have set $timestamps = true;

<?php 

 class SitemapData extends Eloquent {

        public $timestamps = true;
}

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.


It is possible actually:

$model->updated_at = Carbon::now();
$model->save(['timestamps' => FALSE]);

That will properly save the updated_at to now. If you're not sure if any of the model's columns have changed, but you do want to update the updated_at regardless - this is the way to go.