filament-impersonate
filament-impersonate copied to clipboard
Trapped in exception when impersonating soft-deleted user
I attempted to impersonate a soft-deleted user, which ends up trapping me in the following exception:
Filament\FilamentManager::getUserName(): Argument #1 ($user) must be of type Illuminate\Database\Eloquent\Model|Illuminate\Contracts\Auth\Authenticatable, null given
in reference to
<x-filament-impersonate::banner/>
I understand why this is probably happening; the intended $user is not being hydrated ->withTrashed()
applied. Where exactly do I go to customize the banner, given that in the current version, it is being injected via a render hook? i.e., I did not place x-impersonate::banner
into my master layout.
Temporary solution to break out of the exception was to set FILAMENT_IMPERSONATE_BANNER_RENDER_HOOK=""
in .env so that I could log back in.
I have the same problem and I still haven't been able to solve it, in my case the User model doesn't have softdelete, it's the default laravel model, but I have a TenantScope.
If you find a solution you can share it.