An impersonating banner for Nova 4
rhyslees/nova-impersonating-banner is a Laravel package for an impersonating banner for nova 4.
It currently has 6 GitHub stars and 26.773 downloads on Packagist (latest version v3.2.0).
Install it with composer require rhyslees/nova-impersonating-banner.
Discover more Laravel packages by rhyslees
or browse all Laravel packages to compare alternatives.
Last updated

Ensure you are using the web middleware on your routes.
Ensure you have read the Nova Impersonation Docs
Require this package with composer.
composer require rhyslees/nova-impersonating-banner
php artisan vendor:publish --provider="RhysLees\NovaImpersonatingBanner\NovaImpersonatingBannerServiceProvider"
npm install && npm run build
Add the following livewire component to your layouts app.blade.php and guest.blade.php
@livewire('nova-impersonating-banner')
or
<livewire:nova-impersonating-banner />
app.blade.php<body class="font-sans antialiased">
<x-jet-banner />
<div class="min-h-screen bg-gray-100">
@livewire('nova-impersonating-banner')
@livewire('navigation-menu')
...
guest.blade.php<body>
<div class="font-sans text-gray-900 antialiased">
@livewire('nova-impersonating-banner')
{{ $slot }}
...
The user you are impersonating is passed into the livewire component as $impersonating so you can select what information you wish to show to the user
<div class="flex-grow">
<p class="text-sm">{{ $impersonating->id }} - {{ $impersonating->name }}</p>
<p class="text-sm">{{ $impersonating->email }}</p>
</div>
To change the redirect url when you stop impersonating, you can edit the config file config/nova.php
/*
|--------------------------------------------------------------------------
| Nova Impersonation Redirection URLs
|--------------------------------------------------------------------------
|
| This configuration option allows you to specify a URL where Nova should
| redirect an administrator after impersonating another user and a URL
| to redirect the administrator after stopping impersonating a user.
|
*/
'impersonation' => [
'started' => '/',
'stopped' => '/',
],