Giorgiovski
1 month ago
253
8
Laravel

Wrong redirection after login

Posted 1 month ago by Giorgiovski

First, in the beginning, I moved from /home to /profile. I deleted all redirections and details about /home of the entire app. It worked with zero problems. The issue is that after I moved from XAMPP to HOMESTEAD. When the user finishes the registration process, he is redirected to /home. And of course, it is not found. I repeat I have this issue because I installed Homestead.

I have no result when I'm searching for /home in my app, I cleared all caches, I checked all the files associated with redirection. By the way, my RedirectIfAuth looks like:

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check()) {
            return redirect('profile/'.auth()->user()->id);
        }

        return $next($request);
    }
}

The error:

/home/vagrant/LaravelProjects/Changizator/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php#179
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
            return $this->getRouteForMethods($request, $others);
        }

        throw new NotFoundHttpException;
    } 

I can't understand where is the problem because worked months but after I installed Homestead that was the result. Thank you very much.

Please sign in or create an account to participate in this conversation.