Laravel 13.2.0 adds a set of new symmetrical, expressive PHP attributes for Eloquent models, enum support in #[Queue] and #[Connection] attributes, and more.
Key highlights include:
- New symmetrical Eloquent model attributes (
#[DateFormat],#[WithoutTimestamps], and more) - Enum support in
#[Queue]and#[Connection]queue attributes releaseOnSignalparameter forwithoutOverlapping()to handle unexpected process terminationUniqueConstraintViolationExceptionnow includes column and index informationschedule:listdisplays cron expressions in the correct timezone
What's New
Symmetrical Eloquent Model Attributes
PR #59284 adds a set of focused, single-purpose attributes as alternatives to multi-parameter attributes like #[Table]. Rather than packing multiple concerns into one attribute, each concern now has its own dedicated attribute:
// Before#[Table(timestamps: false, dateFormat: 'U')]class Post extends Model {} // After#[DateFormat('U')]#[WithoutTimestamps]class Post extends Model {}
The new attributes mirror properties that already exist on Eloquent models, making it easier to configure model behavior declaratively at the class level.
Pull Request: #59284
Enum Support in #[Queue] and #[Connection]
The #[Queue] and #[Connection] PHP attributes now accept backed enums directly, so you can pass an enum case without calling ->value:
// Before#[Queue(Queues::LOGS_INGESTION->value)]final class IngestAuditLog implements ShouldQueue {} // After#[Queue(Queues::LOGS_INGESTION)]final class IngestAuditLog implements ShouldQueue {}
This brings the attribute behavior in line with what was already supported through the property directly.
Pull Request: #59278
releaseOnSignal for withoutOverlapping()
withoutOverlapping() now accepts a releaseOnSignal parameter. When true, the overlap lock (stored as a cache key) is released if the process receives a termination signal (SIGTERM, SIGINT, or SIGQUIT), so the task can run again immediately when the scheduler restarts.
Without this, if a scheduler process is killed while a task is running — which can happen on managed infrastructure — the lock is left set and the task won't run again until the overlap TTL expires.
Artisan::command('reports:generate', function () { // ...})->withoutOverlapping(releaseOnSignal: true);
Requires the pcntl extension.
Pull Request: #59298
UniqueConstraintViolationException Includes Column and Index Details
UniqueConstraintViolationException now exposes the columns and index name involved in a unique constraint violation. The available data varies by database driver:
| Driver | columns |
index |
|---|---|---|
| SQLite | ✅ | ❌ |
| PostgreSQL | ✅ | ✅ |
| MySQL | ❌ | ✅ |
| SQL Server | ❌ | ✅ |
try { User::create(['email' => 'taken@example.com']);} catch (UniqueConstraintViolationException $e) { $e->columns; // e.g. ['email'] on PostgreSQL/SQLite $e->index; // e.g. 'users_email_unique' on PostgreSQL/MySQL/SQL Server}
Pull Request: #59299
schedule:list Displays Expressions in the Correct Timezone
The schedule:list command now shows cron expressions adjusted to the timezone configured on each task, rather than always displaying them in the application's default timezone. This makes the output consistent with when the task will actually run.
Pull Request: #59286
Backoff Attribute is Now Variadic
The #[Backoff] attribute now accepts a variadic list of delay values, matching the array-based approach available via the backoff property on queued jobs:
#[Backoff(10, 30, 60)]class ProcessOrder implements ShouldQueue {}
Pull Request: #59354
Magic Factory Methods Accept Multiple Arrays
The dynamic has*() factory methods (e.g., hasPosts(), hasTags()) now accept multiple arrays, so you can pass different attribute sets for each related model without using forEachSequence() manually:
User::factory() ->hasPosts(['title' => 'First Post'], ['title' => 'Second Post']) ->create();
Under the hood, passing multiple arrays triggers forEachSequence(), creating one related model per array with the given attributes.
Pull Request: #59343
Other Fixes and Improvements
Queue & Workers:
- Added a
TimedOutworker stop reason (#59310) - Allow opting out of worker job exception reporting (#59308)
- Bound the error page query listener to prevent memory bloat in Octane (#59309)
Models & Database:
- Fixed
Tableattribute incrementing not working for Pivot models (#59336) - Ensured
ScopedByattribute works with inheritance (#59332) - Allowed passing enums to model attributes (#59297)
- Ensured
connectUsing()works withUnitEnum(#59306)
Collections:
sum()callback now receives the item key as the second argument (#59322)
HTTP & Streaming:
- Handle exceptions in
eventStream()to prevent fatal errors (#59292) - Fixed
LazyPromise::wait()signature compatibility with Guzzle'sPromiseInterface(#59301)
Testing:
- Fixed missing
assertDontSeeInHtml()negation assertion (#59303)
Error Page:
- Added mobile safe-area-inset support to the exception renderer (#59341)
Performance:
- Improved raw SQL binding substitution performance (#59277)