2.4 KiB
2.4 KiB
Architecture
Major Modules
User Management Module
- Purpose: Handles user authentication, roles, and permissions
- Key Components:
Usermodel with hierarchical relationships (parent/children)- 13 user types via enum (Ultimate through Public)
- Permission system via
UserActionsenum
- Location:
app/Models/User.php,app/Enums/UserTypes.php
Market Module
- Purpose: Product and store management
- Key Components:
Productmodel - Products with categories, stores relationshipStoremodel - Stores with products via belongsToManyProductTransactionmodels - Transaction tracking
- Location:
app/Models/Market/
File Management Module
- Purpose: File upload and management system
- Key Components:
FileContentmodel - Binary file storageFileListmodel - File metadata
- Location:
app/Models/FileContent.php,app/Models/FileList.php
Module Interactions
User (Auth) → Middleware → Controllers → Models
↓
Market Models
↓
File Management
Authentication Flow
- User attempts to access protected route
Authenticatemiddleware checks session/JWT- User object loaded with roles and permissions
- Route middleware (
auth,ultimate, etc.) validates access
Data Flows
Login Flow
POST /post/loginnow → LoginController@authenticate
↓
Auth::attempt() (JWT-based)
↓
Session created via Hypervel\Session
↓
Redirect to home or return JSON response
User Creation Flow
POST /admin/user/create → CreateUserControllerUltimate@CreateUser
↓
Validate data (mobile number, username uniqueness)
↓
Create user record with encrypted password
↓
Return success/error response
Product View Flow
POST /View/Product/Details/data → ProductController@viewProductDetails
↓
Fetch product by ID
↓
Fetch associated stores
↓
Return product data with store info
External Services
- Redis: Caching layer (configurable via CACHE_DRIVER)
- Session Storage: Database-backed sessions
- File Storage: Local filesystem (via Flysystem)
Architectural Patterns
- MVC Pattern: Models-Views-Controllers separation
- SPA Architecture: Single Page Application with Vue Router
- Middleware Chain: Request filtering via Hypervel middleware
- Enum-based Roles: Type-safe user role system