Support the ongoing development of →
posted 11 months ago
Last updated by @tjmahaffey 11 months ago.

Try to follow the syntax given in the official laravel documentation for the handle method

public function handle($request, Closure $next)
        if ($request->input('age') < 200)
            return redirect('home');
        return $next($request);

Use only $request variable without type hinting as shown in the example above and see if everything works.

Solution selected by @tjmahaffey

AH!! That was it, @faisal ! I totally overlooked that inconsistency and never would have guessed that simple type hinting would break that request object.

Thank you!


Happy to help people in resolving their issues.


Sign in to participate in this thread!


Your banner here too?


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

Your logo here?

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

© 2023 - All rights reserved.