Skip to content

Allow custom middleware to be registered#1892

Merged
taylorotwell merged 1 commit into13.xfrom
middleware
Feb 22, 2026
Merged

Allow custom middleware to be registered#1892
taylorotwell merged 1 commit into13.xfrom
middleware

Conversation

@timacdonald
Copy link
Member

@timacdonald timacdonald commented Feb 22, 2026

Like other packages, such as Fortify, Nova, and Horizon, this adds the ability to add custom middleware, via config, to the routes passport registers.

The motivation behind this feature is to allow us to intercept any passport routes and enforce certain rules. The main one being that the client_id must be a UUID.

Right now, when someone hits our application with client_id=123, a query exception is thrown as the database is expecting a UUID. For most databases, it probably just 404s, but for certain databases, they error out when the wrong type is used for the query.

This would allow us to create a similar pattern we use for our routes, where we 404 before we even hit the database, e.g.,

Route::get('environments/{environment}')
    ->whereUuid('environment');

The middleware will allow us to handle query parameters (the current problem) as well as route parameters.

Comment on lines +18 to +19
'middleware' => [],

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure this could use some Taylor comment love.

@taylorotwell taylorotwell merged commit d46000e into 13.x Feb 22, 2026
15 checks passed
@taylorotwell taylorotwell deleted the middleware branch February 22, 2026 23:54
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.

2 participants