Through Laravel 10, I was able to check if the ConvertEmptyStringsToNull middleware was globally registered by using the following code:
$kernel = $this->getLaravel()->make('App\\Http\\Kernel');
$exists = $kernel->hasMiddleware(\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class);
However, the Kernel class was removed in Laravel 11. How can I check if the ConvertEmptyStringsToNull middleware is registered now?
The
App\Http\Kernelclass was removed from the Laravel 11 skeleton application, but theIlluminate\Foundation\Http\Kernelclass is still used by the framework. Additionally, as seen in theindex.php, you can resolve the used instance from theIlluminate\Contracts\Http\Kernelinterface.You should be able to update your code to: