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

ST_md's avatar
Level 1

How to apply for a user role in Laravel web application based on user activities with Azure AD (Login) and ms graph ( Microsoft Graph)?

Hi,

I am new to Laravel. I have a Laravel web app (SchoolApp) registered on the Azure AD (App registrations). I have 3 user roles: Admin, Teacher, and student. I need to restrict some nav menus base on the user role. How can I do that? Can somebody guide me in the correct code? please?

Code: restrict for Teacher and student

@if(isset($userName))

     <li class="nav-item" data-turbolinks="false">
       <a class="navbar-brand d-flex align-items-center" href="{<!-- -->{ url('/registration_view') }}">
               {<!-- -->{ __(' User registration ') }}
       </a>
     </li>

@endif

Code: restrict for student

@if(isset($userName))

     <li class="nav-item" data-turbolinks="false">
       <a class="navbar-brand d-flex align-items-center" href="{<!-- -->{ url('/Report_view') }}">
               {<!-- -->{ __(' student Report ') }}
       </a>
     </li>

@endif

0 likes
2 replies
ST_md's avatar
Level 1

@RayC Thanks!

The user roles are based on Azure AD App registration.

Please or to participate in this conversation.