This field allows you to authenticate as your users.
Behind the scenes 404labfr/laravel-impersonate is used.
You can install the package in to a Laravel app that uses Nova via composer:
composer require kabbouchi/nova-impersonate
php artisan vendor:publish --tag=nova-impersonate-views
Add Impersonate::make($this->id)
field in App\Nova\User.php
<?php
namespace App\Nova;
use KABBOUCHI\NovaImpersonate\Impersonate;
...
class User extends Resource
{
...
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Gravatar::make(),
Text::make('Name')
->sortable()
->rules('required', 'max:255'),
Text::make('Email')
->sortable()
->rules('required', 'email', 'max:255')
->creationRules('unique:users,email')
->updateRules('unique:users,email,{{resourceId}}'),
Password::make('Password')
->onlyOnForms()
->creationRules('required', 'string', 'min:6')
->updateRules('nullable', 'string', 'min:6'),
Impersonate::make($this->id), // <---
// or
Impersonate::make()->withMeta([ 'id' => $this->id ]),
// or
Impersonate::make()->withMeta([
'id' => $this->id,
'hideText' => false,
]),
];
}
...
}
The MIT License (MIT). Please see License File for more information.