Skip to content

feat: saveMany() now injects timestamps#217

Merged
techmahedy merged 1 commit intodoppar:3.xfrom
techmahedy:techmahedy-3.x
Mar 11, 2026
Merged

feat: saveMany() now injects timestamps#217
techmahedy merged 1 commit intodoppar:3.xfrom
techmahedy:techmahedy-3.x

Conversation

@techmahedy
Copy link
Copy Markdown
Member

Problem

saveMany() was calling insertMany() directly without adding timestamps,
even when $timeStamps = true on the model, though it was intentional previously. But now it supports $timeStamps = true

Before Fix

name email created_at updated_at
John Doe john@test.com NULL NULL
Jane Doe jane@test.com NULL NULL

After Fix

name email created_at updated_at
John Doe john@test.com 2026-03-11 08:30:00 2026-03-11 08:30:00
Jane Doe jane@test.com 2026-03-11 08:30:00 2026-03-11 08:30:00

Changes

  • saveMany() now checks $timeStamps on the model before bulk insert
  • created_at is only set if not already provided by the caller
  • updated_at is always set to current time
  • Respects #[CastToDate] attribute for date-only timestamps, consistent with save() and create()

@techmahedy techmahedy merged commit 7661897 into doppar:3.x Mar 11, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant