Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Luis Mata's avatar

how to redirect from a middleware to a custom tool component in laravel nova

  • Laravel Version: 7
  • Nova Version: 3
  • PHP Version: 7.4
  • Database Driver & Version:
  • Operating System and Version: MacOS
  • Browser type and version: Chrome
  • Reproduction Repository: https://github.com/###/###

Description:

I am trying to redirect a user after checking for a condition in a middleware, I have tried to use

return redirect('/admin/paddle-subscription');

But it does not work, it just redirects the page and shows it right in the browser url but show a 404 error in the screen, it looks that as nova uses vue.js it is creating some kind of errors.

I have been reading some post in laracast https://laracasts.com/discuss/channels/nova/nova-resource-route-redirect and it is clearer to me that it requires a special way to redirect.

I have tried

     return redirect()->action('\Laravel\Nova\Http\Controllers\RouterController@show', ['resource' => '/admin/paddle-subscription']);

And it does not work, how I am supposed to redirect properly?

Thanks

0 likes
6 replies
bobbybouwmann's avatar
Level 88

Mmh, good question indeed. It seems that Nova fetches all the tools in a request and then renders them. I don't think you can redirect to a certain tool itself.

What you can do is create a custom dashboard and put the tool on that page. Then you should be able to redirect to the dashboard page because that has a separated URL and renders differently ;)

Documentation: https://nova.laravel.com/docs/3.0/customization/dashboards.html#dashboards

1 like
Luis Mata's avatar

Thanks for the reply @bobbybouwmann , could you elaborate a little bit more?, I could create a dashboard and place a link to the custom tool, how do you image it?

Luis Mata's avatar

@bobbybouwmann then if it is too complex to keep the user inside nova for this maybe I could just create a page outside nova to ask the user for the subscription and then in the tool he/she could see the status and upgrade.

Please or to participate in this conversation.