Laravel 8 - BackPack 5.6: redirect to custom URL after login (no /admin/dasboard)

363 Views Asked by At

I'm working with Laravel 8 and BackPack 5.6.

I setup "setup_dashboard_routes" as false, and now I get 404 after login. The thing is, I would like to redirect to a custom URL. Documentation says "you then need to overwrite the login route on your AuthController". But, I don't find which file should I edit/create. I tried on "/Http/Controllers/", "/Http/Controllers/Admin", "/Http/Controllers/Auth".

So, I need some guidance about what should I do to get BackPack redirecting to custom URL after login.

Thank you!

1

There are 1 best solutions below

0
Jorge On

if you want to manage your own Auth Controller, so you need to create:

app/Http/Controllers/Auth/ForgotPasswordController.php
app/Http/Controllers/Auth/LoginController.php
app/Http/Controllers/Auth/RegisterController.php
app/Http/Controllers/Auth/ResetPasswordController.php

For login redirect you need to override:

vendor/backpack/crud/src/app/Http/Controllers/Auth/LoginController.php

If you use Backpack Auth then change "redirectTo" method.

app/Http/Middleware/Authenticate.php

Another easy ways is redirect "dashboard" route

Route::permanentRedirect('/dashboard', '/there');

Cheers.