1

I am trying to figure out how to update a table in controller without updating the column updated_at

I don't want to completely stop updated_at I am using it in other places, I just want to update something and not update the updated_at in a certain place

I tried

$model->timestamps = false;
$model->save();

it still updates the updated_at column

AmHilal
  • 79
  • 9

1 Answers1

1

I think you need to check your database structure and see if this is a database level condition or a Laravel mechanism. You can check the database schema by running the following MySQL command:

describe {table}

If you see anything in the extra column of the results for your updated_at column along these lines:

on update CURRENT_TIMESTAMP

Then this is a database level condition I suggest you remove it. And let Laravel take responsibility for the updated_at column.

Alex Harris
  • 6,172
  • 2
  • 32
  • 57
  • That is exactly what fixed it, thank you ! I assume that is the doing of Voyager ? as in does that automatically if you add the table through the BREAD / Database ? – AmHilal Jan 18 '19 at 20:00