Nova Login As provides an easy way to login as any user from Laravel Nova.
You can install this package via composer using this command:
composer require coderello/nova-login-as
The only thing you need to do in order to make it work after the installation is to add LoginAs
action to the User
Nova resource.
public function actions(Request $request)
{
return [
new \Coderello\LoginAs\Actions\LoginAs,
];
}
Now you can run LoginAs
action on the needed user after which you will be redirected to the home page of the website being authenticated as needed user.
By default you'll be redirected to the home
route if it exists or the /
if not.
If you want, you are free to customize the redirection direction by passing the Closure
with your logic to the ->redirectTo()
method.
public function actions(Request $request)
{
return [
(new \Coderello\LoginAs\Actions\LoginAs)
->redirectTo(function ($user) {
return route('profile', $user);
}),
];
}
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.