$redirectTo

Introduction

$redirectTo(string routeName, Object routeArgs = {}) : void

The $redirectTo instance method accepts a route name and its expected parameters. It will generate the appropriate path and redirect the user.

Always prefer $redirectTo over $generatePath as it abstracts the way in which the redirect is handled, allowing it to be easily changed in the future.

Last updated