24
17

Laravelでupdated_atは更新したくないとき

Last updated at Posted at 2017-03-24

この記事は移行しました!最新の内容はこちらをご覧ください😀

下記のようにするとupdated_atを更新せずにレコード上書きできます。

$item->status = 'xxx';
// 更新日時は更新しない
$item->timestamps = false;
$item->save();

パッチを当てたい場合など、なんらかの理由で更新日時を変更したくないときにどうぞ。

24
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
17