Support the ongoing development of Laravel.io →
Requests Input Validation
Last updated 2 years ago.
0

You should not do that, add stuff to the request later on.

0

Why not? I googled it a lot and some people think it's a good solution. What do you reccomend? Override all() in Request? (which works btw)

Last updated 8 years ago.
0

@phasmaweb, i don't agree with @astroanu too and i'm using a solution almost exactly like yours. See that my middlewware's code is similar to yours, and it's working fine:

public function handle($request, Closure $next)
{
    class SetCustomerOnRequest {
        $request->merge([
            'cli_cod' => 1
        ]);
        return $next($request);
    }
}

Maybe your problem isn't relative with the middleware or the request itself, maybe is the PHP that is comparating the value "0" (zero) and marking that field as invalidated. Try to change this value and check again.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

phasmaweb phasmaweb Joined 24 Nov 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.