Support the ongoing development of Laravel.io →
posted 1 year ago
Last updated by @tjmahaffey 1 year ago.
0
Solution

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.

0
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!

0

Happy to help people in resolving their issues.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.