Blog
Laravel5 min

Laravel 13.42: Typed UUIDs and MigrationFailed Events

Laravel 13.42 adds typed uuid() and ulid() input, a MigrationFailed event, and scheduler skip reasons. What changes for APIs and production migrations.

PHP code editor on a workstation set up for Laravel development

Laravel 13.42.0 landed on November 11, 2026. It is not a headline release, but it fixes two things that matter to teams running APIs and production migrations: typed uuid() and ulid() input helpers, and a MigrationFailed event.

I read the Laravel News write-up and the linked pull requests. Here is what I would use, and where I would be careful.

uuid() and ulid() return objects, not strings

Laravel already had input helpers such as date() and enum(). Version 13.42 adds uuid() and ulid() to the InteractsWithData trait, so they work on $request, Fluent, validated input, Uri query strings, component attributes, and console command input.

$orderId = $request->uuid('order_id'); // Ramsey\Uuid\UuidInterface|null
$token = $request->ulid('token');      // Symfony\Component\Uid\Ulid|null

$validated = $request->safe()->uuid('order_id');

The behavior is what you would expect from a typed helper:

  • missing or empty input returns null;
  • invalid input throws an exception;
  • ulid() only accepts a real ULID. Passing a UUID throws instead of silently converting it.

That removes a common class of bug: comparing strings with different formats and accepting values that look like identifiers but are not. On an endpoint that receives an order_id, the helper validates before the value reaches the model.

A controller example:

public function show(Request $request): JsonResponse
{
    $id = $request->uuid('order_id');

    $order = Order::query()
        ->whereKey($id?->toString())
        ->firstOrFail();

    return response()->json($order);
}

If the identifier is required, add an explicit validation rule. The helper returns null when the field is missing, which may be correct or may be a business error. Do not leave that implicit.

MigrationFailed: what to do when a migration dies halfway

The MigrationFailed event fires when a migration throws. It carries the same migration, method, and name properties as the other migration events, plus the exception. The exception is still re-thrown after the event.

This matters most on MySQL: an ALTER TABLE is not rolled back when a later statement in the same migration fails. You can end up with a half-applied schema while the application keeps serving traffic.

A basic listener to alert and put the app into maintenance mode:

use Illuminate\Database\Events\MigrationFailed;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;

Event::listen(function (MigrationFailed $event) {
    Artisan::call('down');

    Log::channel('slack')->critical("Migration [{$event->name}] failed", [
        'exception' => $event->exception->getMessage(),
    ]);
});

Two caveats:

  1. Artisan::call('down') inside the listener can fail if the database is exactly what broke. For a critical system, prefer an external alert and a healthcheck that stops responding.
  2. Do not swallow the exception. The event is for observability and damage control, not for hiding the failure.

In a pipeline, I would also check migration status before deploying and verify a backup before any destructive change. The event helps you react; it does not replace a rollback plan.

Scheduler: skip reasons and real timezones

ScheduledTaskSkipped now includes a reason property backed by an enum with three cases: ConditionNotMet, Paused, and RanOnAnotherServer. That lets you tell why a task did not run without guessing from logs.

use Illuminate\Console\Events\ScheduledTaskSkipped;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Log;

Event::listen(function (ScheduledTaskSkipped $event) {
    Log::info('Scheduled task skipped', [
        'task' => $event->task->getSummaryForDisplay(),
        'reason' => $event->reason?->value,
    ]);
});

schedule:list --json also changed: it now returns each task’s own cron expression and timezone. Previously everything was converted to the application timezone, which produced an hour of drift after a DST change. If a script parses that JSON, review tasks that define their own timezone().

Other changes I would actually use

  • Uri::origin(): returns a normalized scheme, host, and port. Useful for webhook origin checks, redirects, and URL validation.
  • LostConnectionDetector::detectUsing(): add your own lost-connection check without replacing the full detector. Handy when a proxy such as Vitess returns error messages Laravel does not recognize.
  • PendingProcess macros: previously only worked as the first call in a chain; now they compose.
  • ably/pubsub-server support: broadcasting installation uses the new package. Apps on ably/ably-php 1.x keep working.

How I would apply this to a real migration

If you are moving data from an ERP or CRM into a custom application, the helper and the event are useful, but the real work is the process:

  1. Data inventory: tables, fields, relationships, and business rules.
  2. Explicit mapping: every source field has a destination and a documented transformation.
  3. Rehearsal on a copy: restore a backup in staging, never in production.
  4. Validation by samples and totals: amounts, dates, statuses, and relationships.
  5. Idempotent import: rerun without creating duplicates.
  6. Cutover window and rollback: know how long it takes and how to reverse it.
  7. Observability: MigrationFailed, logs, metrics, and alerts.

The migration code is the visible part. Most of the risk is in the data that does not fit the new model.

If that is where you are, you can see how I approach ERP/CRM data migration, or review the rest of my services for AI-built applications.

Conclusion

Laravel 13.42 is a maintenance release, but it brings two improvements any team with real data should adopt: typed identifier input and visibility when a migration fails. Neither replaces a migration plan. They just make failures easier to catch before users see them.

Upgrading is fast. Designing a migration you can reverse is the work that matters.

Next step

Review my developer profile

If this article matches the kind of product work your team is facing, review my stack or professional availability.

View availabilityReview my stack

Tell me what you need

Name, email, reason and message are enough. I reply within 24 business hours, and if there is an NDA we sign it before sharing details.

0/500
Availability