php - Laravel's ORM sync with timestamps doesn't update timestamps -


given following model relationship definition:

public function receiptants()  {     return $this->belongstomany(user::class)->withtimestamps(); } 

and point in controller updated:

$invite->messages()->get()->each(function($item) use ($auth) {     $item->receiptants()->sync([$auth->user()->id]); }); 

however timestamps remain unaltered when inspect tables directly. expect updated_at @ least updated..

you can call touch() method manually , update timestamps you.

$invite->messages()->get()->each(function($item) use ($auth) {     $item->receiptants()->sync([$auth->user()->id]);     $item->touch(); }); 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -