3
0

updated_atを更新せずにsave()したい?こうやるのよ

Posted at

概要

Eloquentにおいて、save()を行うと基本的にupdated_atが自動で更新されるが、更新させずにsave()を行う方法がある

やり方

timestampsプロパティにfalseをセットする

$project = Project::first();
$project->timestamps = false;
$project->name = 'hoge';
$project->save();

これだけでOK

参考

3
0
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
3
0