1
votes

Error: Missing required parameters for [Route: auth.users.edit] [URI: auth/users/{user}/edit].

I have a middleware, where if the user is missing some details, they will be taken to the edit account page and told to complete their account.

The middleware looks like this.

public function handle($request, Closure $next)
{
    $user = auth()->user();

    if ( // some condition about account completeness ) {

        flash('Please complete your account');
        return redirect()->route('auth.users.edit');
    }

    return $next($request);
}

the route name auth.users.edit corresponds to the route auth/users/{user}/edit. I am assuming the error I am getting is complaining that the middleware does not know the {user} paramater.

The error looks like this:

Missing required parameters for [Route: auth.users.edit] [URI: auth/users/{user}/edit]

2
Did you solve this?linuxartisan
Yes, linuxartisan's answer was correctuser6369603

2 Answers

0
votes

You are right when you say

I am assuming the error I am getting is complaining that the middleware does not know the {user} paramater.

You should try this

return redirect()->route('auth.users.edit', [$user]);
0
votes

I ended up just running

valet restart

and it worked.