coderello / nova-login-as
An easy way to login as any user from Laravel Nova.
Installs: 91 617
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/coderello/nova-login-as
Requires
- php: >=7.1
This package is auto-updated.
Last update: 2020-09-19 18:39:15 UTC
README
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.