Overview
TheDashboardController manages the main dashboard interface that users see after successful authentication. It serves as the central hub for authenticated users to access various features of the Apartado de Salas system.
Location: app/controllers/DashboardController.php
Methods
index()
Displays the main dashboard view. Requires user authentication.Renders the dashboard view
This method requires an active user session. Unauthenticated users will be redirected to the login page by the
Auth::requireLogin() helper.Access Control
Authentication Requirement
All dashboard routes require authentication:- If authenticated: Dashboard view is rendered
- If not authenticated: User is redirected to
/login
Route Details
GET /dashboard
Controller:DashboardControllerMethod:
index()Authentication: Required
Authorization: Any authenticated user Flow:
- User navigates to
/dashboard Auth::requireLogin()verifies active session- If valid session exists, dashboard view is loaded
- If no valid session, redirect to
/login
Dashboard Features
The dashboard typically provides access to:- Regular Users
- Administrators
- View their own reservations
- Create new reservations
- Check reservation status
- Access room availability
Dependencies
Session- Helper for session managementAuth- Helper for authentication verification
Usage Flow
Typical User Journey
Code Example: Redirect After Login
Code Example: Protected Dashboard Access
Session Data Available
When the dashboard loads, the following session data is typically available:Integration Points
The dashboard serves as the central navigation hub, linking to:Reservation Management
Admin Functions (if user has admin role)
Authentication
Security Considerations
The dashboard controller implements minimal business logic by design. All authentication and authorization checks are delegated to the
Auth helper class, following the single responsibility principle.-
Session Verification
- Every request checks for active session via
Auth::requireLogin() - Invalid or expired sessions redirect to login
- Every request checks for active session via
-
Role-Based Access
- Dashboard adapts content based on user role
- Admin-only features are hidden from regular users
-
No Direct Database Access
- Dashboard controller doesn’t query database directly
- All data fetching delegated to appropriate models/controllers