Skip to content

Laravel 13.44 lets form requests fetch their own models

New model(), modelOrFail() and models() helpers load Eloquent records straight from request input, but the release briefly broke every Laravel Nova request.

Source: Laravel

Laravel 13.44.0, tagged on 24 November, adds a new InteractsWithModels trait to FormRequest, giving every request three new methods for pulling Eloquent models straight out of the input.

$user = $request->model('user_id', User::class);
$user = $request->modelOrFail('user_id', User::class);
$users = $request->models('user_ids', User::class);

Leave out the model class and Laravel infers it from the key, so user_id resolves to App\Models\User on its own. The catch surfaced fast: any existing FormRequest subclass that already defined its own model() with a different signature started throwing a fatal error the moment the class loaded, including Laravel Nova’s NovaRequest, which defines a parameterless model(). Because Nova 5.12.0 allows illuminate/support ^13.0, Composer happily installed it alongside 13.44.0 with no warning, so every Nova request broke. A Laravel core team member shipped a fix on Nova’s side the next day and closed the issue on 25 November.

Why it matters: the new helpers cut out a line of boilerplate in nearly every controller that writes to a model. If you run Nova, or any package with its own FormRequest::model() override, make sure you’re on the patched Nova release before you touch 13.44.0.

The caveat: the fix landed in Nova, not in the framework’s new trait, so any other package defining its own model() on a form request is still exposed to the same clash.

Share

Related reading

More from The Wire

All briefs