$guest
Middleware
The $guest
middleware is intended for pages that should only be accessible to guest users—those who are not logged in. This is particularly useful for routes like login or registration pages, where you don't want authenticated users to have access.
Usage Example
To apply the $guest
middleware, include it in the middleware
property of the relevant page component or route configuration:
javascript
definePageMeta({
middleware: ['$guest'],
});
When an authenticated user attempts to access a page protected by $guest
, they will be redirected to another page, typically the home page or a dashboard.