Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

NickvdMeij's avatar

[L5] Basic Authentication with Roles and Middleware

Hi,

Recently i've been working on a basic auth login for handeling access to certain pages. With mobile development in mind, I made an API for my site. However, I'm having trouble with getting my thought around how to approach this propperly. I have roles and permissions made with Zizaco/entrust, but how can i use this to make a middleware for Basic Auth. Laravel implements an auth.basic middleware, but is there a way to customise this to reflect certain roles?

All this, in my opinion, would be an awesome video to watch. Not only does it handle the basic Role management most websites need, but also covers how to protect your API and how to let people with certain rights access various pages.

Thanks in advance, Nick van der Meij

0 likes
1 reply

Please or to participate in this conversation.