coderello/nova-login-as

This package is abandoned and no longer maintained. No replacement package was suggested.

An easy way to login as any user from Laravel Nova.

0.1.1 2019-02-21 09:44 UTC

This package is auto-updated.

Last update: 2020-09-19 18:39:15 UTC


README

Nova Login As

Nova Login As provides an easy way to login as any user from Laravel Nova.

Install

You can install this package via composer using this command:

composer require coderello/nova-login-as

Usage

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.

Redirection direction

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);
            }),
    ];
}

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.