Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Nova Impersonation - Redirects to / would like to redirect to backend

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.

like image 837
Grant Avatar asked Oct 20 '25 10:10

Grant


1 Answers

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.

like image 117
Leith Avatar answered Oct 22 '25 00:10

Leith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!