Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Mass Update

Laravel Mass Update Laravel Package

iksaku/laravel-mass-update

Laravel Mass Update lets you update multiple Eloquent records with different values in a single SQL query. Instead of looping through models, pass an array of updates and let the package generate efficient CASE-based UPDATE statements for faster bulk edits.

View on GitHub
Deep Wiki
Context7

Update multiple Laravel Model records, each with its own set of values, sending a single query to your database!

Frequently asked questions about Laravel Mass Update
How do I install iksaku/laravel-mass-update?
Install it with Composer using composer require iksaku/laravel-mass-update. It is a thin Eloquent extension with no service provider configuration surface, no queue or cache dependencies, and no environment variables to set. In most projects the integration is simply adding the package to composer.json and running composer update.
How does Laravel Mass Update update many records with different values in one query?
Instead of looping over models and issuing one UPDATE per row, you pass an array of per-model updates and the package compiles them into a single CASE-based UPDATE statement. That single query is sent to your database, avoiding row-by-row hydration and per-model event dispatch. The result is significantly higher throughput for bulk edits where each record needs different values.
Which Laravel versions does this package support?
Version 2.0.0 adds a Laravel 13.x compatibility constraint, which is the main reason to upgrade now if your app is moving to Laravel 13. Earlier releases such as 1.0.9 target older framework versions. Always check the composer constraint matrix in the package's composer.json to confirm the exact Laravel and PHP versions supported before merging an upgrade.
Does Laravel Mass Update fire model events, observers, and timestamps?
No. The package bypasses per-model event dispatch and row-by-row hydration, so observers, model events, casts, and mutators are not applied. If you need event suppression beyond that, wrap the call in Model::withoutEvents(). For timestamps, wrap the call in Model::withoutTimestamps() if you do not want updated_at touched.
What changed in version 2.0.0 and how do I migrate from massUpdateQuietly()?
Version 2.0.0 removes the Mode::massUpdateQuietly() static method, which is a hard error at runtime rather than a deprecation. Ripgrep your codebase for massUpdateQuietly and replace each hit with an explicit Model::withoutTimestamps(fn () => ...) wrapper around the existing mass update call, preserving the surrounding query conditions verbatim. If the old call also relied on suppressing other listeners, combine it with Model::withoutEvents() instead of assuming equivalence.
Are Eloquent casts and mutators applied during a mass update?
No. Bulk updates run at the query level and bypass casts, mutators, and accessors, so you must pass values that are already in the shape your database column expects. This behavior varies slightly across MySQL, Postgres, and SQLite, so validate the formatting of dates, booleans, and JSON columns on your actual driver.
How should I test bulk updates with this package in CI?
Because the package generates dialect-specific bulk UPDATE SQL, a green suite on SQLite does not certify MySQL or Postgres. Run your mass-update tests against every database driver you deploy, inside transactions or with database refresh between tests. Also assert the resulting rows directly with the query builder rather than reloading models, since model events and casts are skipped.
Does Laravel Mass Update work with database transactions?
Yes. The package sits directly on top of the Eloquent builder and query grammar, so it inherits Laravel's connection resolution and transaction semantics. That means a batch update participates in any surrounding DB::transaction() the same way a normal builder update would. Rollbacks behave as expected because only a single statement is executed.
Is iksaku/laravel-mass-update safe to use in production?
It is a small, single-maintainer community package, which is acceptable for a bulk-write optimization but risky as a load-bearing path for data integrity. Keep a fallback to DB::table()->update() for critical writes, and be aware that bypassed events matter on audit-sensitive tables where search indexing, webhooks, or CDC consumers depend on model events. Pin your constraint and review changelogs before upgrading major versions.
How does it compare to Eloquent upsert() or looping through models?
Looping through models issues one UPDATE per record and fires all events and casts, which is correct but slow for large batches. Eloquent's upsert() is designed for insert-or-update against a unique key and does not fit arbitrary per-row value changes as cleanly. Laravel Mass Update fills the gap by updating existing records with distinct values in one statement, trading events and casts for throughput.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle