How juanhdezz/tfg_gestion_ccia works
Main Components
• Web Client: Represents the user’s browser and the client-side interactions. The frontend is served via Blade templates (located in resources/views) and assets managed by Vite (see package.json, vite.config.js, resources/js/app.js, etc.).
• Web Server: The Apache server provided by XAMPP handles HTTP requests. This is the entry point for users (as per the README, they point their browser to the public folder).
• Laravel Application: The core of the system includes:
• Controllers (app/Http/Controllers) which process incoming requests, handle authentication (see the Auth controllers), manage resources (asignaturas, tutoria, usuarios, etc.), and return responses.
• Models (app/Models) that represent the application’s data structures and interact with the database.
• Middleware (app/Http/Middleware) handling aspects such as authorization and database switching.
• Routes (routes/web.php and routes/auth.php) which define URL endpoints and their corresponding controllers.
• Views (resources/views) for rendering UI.
• Database: The application interacts with a MySQL database (as instructed via phpMyAdmin in the README). The schema is maintained by migrations (database/migrations), and there are seeders to set up roles and permissions.
Understand the Flow and Interactions
• When a user accesses the application from their browser, the HTTP request is received by the Apache web server.
• The request is then routed to the Laravel application where:
• The routes (defined in the routes folder) determine which controller to invoke.
• The controllers process the request, often utilizing Models to fetch or update data.
• Middlewares (such as EnsureUserIsAdmin and DatabaseSwitcher) inspect and modify the requests/responses.
• Blade views in resources/views are returned as the response rendered for the user.
• Frontend assets (JavaScript, CSS) are built with Vite and served from the public/build folder.
• Data persistence is managed with a MySQL database, with schema managed via migrations and initial data loaded using seeders.
Architectural Patterns and Key Technologies
• MVC Pattern: The Laravel structure strongly adheres to the Model-View-Controller pattern.
• Service Providers: Custom providers (e.g., AppServiceProvider) wire up application services.
• Middleware: For cross-cutting concerns like authentication and request modification.
• Bundling: Vite for frontend asset compilation.
• Testing: Integration and unit tests (present in tests/Feature and tests/Unit) employ tools like PHPUnit and Pest.
• External Dependencies: Composer for PHP package management and Node.js/npm for JavaScript dependencies.
• Database Management: Migrations and seeders (also exporting capabilities seen in app/Exports).
Detailed Elements
• Each component should be labeled:
• “Client Browser (HTML/CSS/JS via Blade Templates)”
• “Web Server (Apache via XAMPP)”
• “Laravel Application” (then break down into sub-components):
• “Controllers” (with examples: AsignaturaController, Auth controllers, etc.)
• “Models” (e.g., Asignatura, User, etc.)
• “Middleware” (e.g., EnsureUserIsAdmin, DatabaseSwitcher)
• “Routes” (web.php, auth.php)
• “Views” (Blade templates for auth, dashboard, etc.)
• “Database (MySQL)” for data persistence.
• “Asset Management (Vite, Node.js)” for compiling and serving frontend assets.
• Request and Response flows between Client, Web Server, and Laravel Application.
• Internal interactions between Controllers and Models.
• Middleware intercepting requests.
• Bidirectional data flow between Laravel Application and Database.
• Optionally, include ancillary components like testing, Composer-based dependency management, and asset pipelines that ensure comprehensive coverage.