3

I'm using the new (as of writing this) Laravel Nova 4.0 and the official impersonation trait / implementation.

When I impersonate a user it redirects to the frontend homepage /. I would like it to redirect to /admin in general. If I can achieve this, I'd really like to have more granular control which users (based on a simple user type) go to which route by default.

I can't find anything in the documentation, looking through the code or other questions asked in Nova threads.

Leith
  • 3,139
  • 1
  • 27
  • 38
Grant
  • 5,709
  • 2
  • 38
  • 50

1 Answers1

1

config/nova.php has options as to which URLs you can use when starting/stopping impersonation:

    'impersonation' => [
        // NOTE: change this from the default '/'
        'started' => '/admin',
        'stopped' => '/',
    ],

Because this is loaded as a config file, it's potentially worth noting that you can't use named routes here as the configuration will be bootstrapped in before the routes are defined.

Leith
  • 3,139
  • 1
  • 27
  • 38
  • Perfect, thank you. Is this in the documentation? I couldn't find anything about it. – Grant Nov 07 '22 at 04:55
  • 1
    @Grant Nothing in the docs yet, was in the [v4.14.0 release notes](https://nova.laravel.com/releases/4.14.0) then just diving into the config/source updates to see what changed. – Leith Nov 07 '22 at 20:08