How to update timestamp in pivot table in Laravel

When insert a new row to pivot table, we can use attach() method like this:

But this will not update created_at and updated_at timestamps column in pivot table.

To update timestamps, use withTimestamps() method on the relationship method.



You may also like...

Leave a Reply