0

laravel pivot table attach 的时候created_at和updated_at不更新

neo created at6 years ago view count: 2280

$post->users()->attach(1);

发现created_at和updated_at都没有值。model里面已经设置timestamp=true

report
回复
0

加一个withTimestamps,同时修一下之前的数据。

return $this->belongsToMany('Role')->withTimestamps();

6 years ago 回复