Route: process through a controller and redirect


#1

I want to define a route that does the following:

  1. Takes the route (URL) parameters and saves them to the database (for analytics/logging purposes)
  2. Then redirects to a new link, using some, or all, of the original URL parameters.

Possible? Any short example of this?

Thanks


#2

If you want to apply to more than one route, a Middleware is what you want to capture the route data.

No doc on this, but here’s an example of a middleware : https://github.com/userfrosting/UserFrosting/blob/4dda14f611b6de5764e05d22538f5c179b0a18f7/app/sprinkles/account/src/Authenticate/AuthGuard.php