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)
@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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community