-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Open
Labels
Description
Laravel Version
12.40.2
PHP Version
8.4.15
Database Driver & Version
MySql 9.1.0 on Debian 13
Description
In a previous Laravel version (10.48.29) i created a custom middleware to catch a specific value in the api request path. This, in the handle method, made use of the following:
$request->route('company')
It doesn't work in the newest Laravel version (12.40.2)
Steps To Reproduce
In brief:
laravel new myproject
php artisan install:api
php artisan make:middleware ApiRouteCheck
- Added the custom middleware in the bootstrap/app.php:
use App\Http\Middleware\ApiRouteCheck;
and:
->withMiddleware(function (Middleware $middleware): void {
$middleware->append(ApiRouteCheck::class);
})
- Inside the created middleware, in the handle method, the same:
$request->route('company')
is empty.
Have I missed something else or is it a bug?
Is there another way to read the value in the newer Laravel version?
Thanks, kind regards.