Level 54
Add a custom middleware and you can add additional functionality to check custom table there.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello there, Laravel newbie here :)
I wrote a RESTful API and I've enabled Sanctum and the tokens work without problems.
Here my problem and question.
When I receive a token I should check a custom table on Database and if in this table I have some fields with particular values I have to return a 401 instead of return any route the remote client asked me.
Do you have some suggestion how I could achieve something like that? Thank you!
Add a custom middleware and you can add additional functionality to check custom table there.
Please or to participate in this conversation.