-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirecting to Nova resource from Laravel login #2098
Comments
To solve the users redirect you should:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class LoginController extends \Laravel\Nova\Http\Controllers\LoginController {
/**
* The user has been authenticated.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
* @return mixed
*/
protected function authenticated(Request $request, $user)
{
// You're authenticated!
return redirect('/');
}
} And bind this extension on NovaServiceProvider: <?php
namespace App\Providers;
use Laravel\Nova\Http\Controllers\LoginController;
...
class NovaServiceProvider extends NovaApplicationServiceProvider {
...
public function register()
{
$this->app->bind(LoginController::class, \App\Http\Controllers\LoginController::class);
}
} And to solve multiple authentication tables is other issue. The before code solve the redirecting. |
Many Thanks for the quick guidance Demency.. Will try this and revert back.. Take care |
Alternatively, just build the login flow as your project requires. We realize Nova's conventions may not work for everyone and expect there to be some customization from time to time. |
I fixed it like this, in a component add the following and it works. router.beforeEach((to, from, next) => {
if (to.name == 'dashboard.custom') {
next({
name: 'index',
params: {
resourceName: 'orders'
}
})
} else {
next()
}
}) |
Thank you iBet7o Best |
The clean solution for Inside
Happy coding :) |
Hello Guys,
Our requirement is to login to 4 different tables and redirect users to Nova dashboards according to the roles. The login controllers are in Laravel as Nova supports only single Auth(Table). We are trying this for the past two days, played around with middleware,routes, redirects etc. but no luck. Any guidance is appreciated. Thanks in advance
The text was updated successfully, but these errors were encountered: