Skip to content
Advertisement

LARAVEL – How to change Auth::route() paths to custom address

I am working on laravel7 Project, I want to change default Auth::route() route paths

I have login page and I want to change it to something like: /random/random2/random3/login

but laravel auth comes with “/login”. how can I edit it?

Advertisement

Answer

If you just want to prefix them, you can wrap it in a route group:

Route::prefix('random/random2/random3/')->group(function(){
    Auth::routes();
}).

I haven’t tested this but it should work because Laravel references the routes by their name (e.g. route('login')) which would stay the same.

Alternatively you could just define your own routes instead of using Auth::routes() at all. You can copy the routes from the laravel/ui package and adjust them as needed.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement