Login as any user from Laravel Nova

Have you ever needed to login as the user of your website? For example to test something or investigate the issue reported by this user.

I had such cases and decided to develop a tiny package for Laravel Nova in order to meet this need.

Nova Login As provides an easy way to login as any user of your website.

You can install it via composer:

composer require coderello/nova-login-as

The only thing you need to do after the installation is to add LoginAs action to the User Nova resource.

public function actions(Request $request)
    return [
        new \Coderello\LoginAs\Actions\LoginAs,

That's all.

Now you can open any user and run an LoginAs action on it in order to login as this user.

After the action completion, you will be redirected to the homepage of your website being authenticated as the needed user.

Pretty convinient, isn't it?