F
Filamentβ€’2mo ago
ericmp

How to make guest-only api endpoints

Via web route, if i want a route to be guest only, i use the guest middleware. Via api route, how this can be achieved?
9 Replies
ericmp
ericmpβ€’2mo ago
bump
Dennis Koch
Dennis Kochβ€’2mo ago
Don't use auth?
ericmp
ericmpβ€’2mo ago
yeah but that will just allow guest users too i want to block auth users like web guest route, but in api or i dont find the middleware for it or is not commonly used and therefore there is not a guest api middleware by default
Dennis Koch
Dennis Kochβ€’2mo ago
Then create a new middleware that blocks auth users?
ericmp
ericmpβ€’2mo ago
πŸ’€yeah but i asked just in case this already existed somehow so i dont reinvent the wheel u know
Dennis Koch
Dennis Kochβ€’2mo ago
Dude. abort_if(auth()->check())
ericmp
ericmpβ€’2mo ago
yes dennis πŸ™Œ
Dennis Koch
Dennis Kochβ€’2mo ago
πŸ˜…
ericmp
ericmpβ€’2mo ago
xD thanks for the help, was just this
Want results from more Discord servers?
Add your server