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
Post a Comment