Level 14
Please try to add the TrimStrings like this
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\TrimStrings::class,
....
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I have added the TrimStrings class in my kernel but it has no effects in my API request.
protected $middleware = [
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
];
I have just added a blank space in my login username and the blank space is not trimmed in the API side of Laravel.
Any idea why please?
I am on Laravel 5.6
Thank you.
Please try to add the TrimStrings like this
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\TrimStrings::class,
....
Please or to participate in this conversation.