mis3085 / laravel-admin-ext-impersonate
User impersonation for laravel-admin
0.0.1
2021-07-30 08:30 UTC
Requires
- php: >=7.1.0
- encore/laravel-admin: ^1.8
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-11-29 06:41:29 UTC
README
Allow administrator to impersonate other backend user.
Publish lang files
php artisan vendor:publish --tag=impersonate-lang
Configuration
Insert into extensions
section in config/admin.php
if u want to customize.
'impersonate' => [
'dialogs' => [
'impersonate' => [
'position' => 'center-right',
],
],
'session_keys' => [
'impersonator' => 'impersonator',
]
],
Usage
- Edit
app\Admin\routes.php
to override the original UserController routes$router->resource('auth/users', 'UserController')->names('auth.users');
- Create
app\Admin\Controllers\UserController
- Extends
Encore\Admin\Controllers\UserController
- Copy
grid()
fromEncore\Admin\Controllers\UserController
- Modify
grid()
-
Use as action in a column
use Mis3085\Impersonate\Actions\ImpersonateAction; $grid->column('ANY_TEXT', 'ANY_TEXT')->action(ImpersonateAction::class);
-
Use as dropdown action
use Mis3085\Impersonate\Actions\ImpersonateAction; $grid->actions(function (Grid\Displayers\Actions $actions) { if (Impersonate::canImpersonateUser($actions->getKey())) { $actions->add(new ImpersonateAction); } // other actions });
-
- Extends