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]