F
Filamentβ€’6mo 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
ericmpOPβ€’6mo ago
bump
Dennis Koch
Dennis Kochβ€’6mo ago
Don't use auth?
ericmp
ericmpOPβ€’6mo 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β€’6mo ago
Then create a new middleware that blocks auth users?
ericmp
ericmpOPβ€’6mo ago
πŸ’€yeah but i asked just in case this already existed somehow so i dont reinvent the wheel u know
Dennis Koch
Dennis Kochβ€’6mo ago
Dude. abort_if(auth()->check())
ericmp
ericmpOPβ€’6mo ago
yes dennis πŸ™Œ
Dennis Koch
Dennis Kochβ€’6mo ago
πŸ˜…
ericmp
ericmpOPβ€’6mo ago
xD thanks for the help, was just this
Want results from more Discord servers?
Add your server