Initial V2 commit 4

This commit is contained in:
Hamza-Ayed
2026-04-22 23:16:23 +03:00
parent 3269a836a2
commit 3f4afd0f5c
47 changed files with 456 additions and 72 deletions

View File

@@ -6,8 +6,15 @@ use Closure;
use Illuminate\Http\Request;
/**
* Admin Role Middleware
* Ensures the authenticated user has admin privileges
* وسيط التحقق من صلاحيات المدير (Admin Role Middleware)
*
* الغرض من الملف:
* حماية المسارات (Routes) التي لا يسمح بالدخول إليها إلا للمدراء فقط.
*
* كيفية العمل:
* 1. يفحص نوع المستخدم المخزن في رمز الـ JWT.
* 2. إذا كان نوع المستخدم ليس "admin"، يرفض الطلب ويرجع خطأ (403 Unauthorized).
* 3. إذا كان مديراً، يسمح للطلب بالمرور للمتحكم (Controller) المعني.
*/
class AdminMiddleware
{