Overview
VIP2CARS is built on Laravel 12, following the Model-View-Controller (MVC) architectural pattern. The system leverages modern Laravel features and integrates Livewire 4 for reactive components and Flux UI for the interface layer.Architectural Pattern
MVC Implementation
VIP2CARS follows Laravel’s MVC pattern with clear separation of concerns:Model Layer
Model Layer
The Model layer handles data logic and database interactions through Eloquent ORM.Core Models:
Cliente- Client/customer managementVehiculo- Vehicle management with client relationshipsUser- User authentication and authorization
/app/Models/View Layer
View Layer
The View layer uses Blade templating engine with Flux UI components for rendering.Key View Directories:
/resources/views/clientes/- Client management views/resources/views/vehiculos/- Vehicle management views/resources/views/layouts/- Application layouts and shared templates/resources/views/components/- Reusable Blade components/resources/views/flux/- Custom Flux UI components
/resources/views/Controller Layer
Controller Layer
The Controller layer processes HTTP requests and coordinates between Models and Views.Core Controllers:
ClienteController- Handles client CRUD operationsVehiculoController- Manages vehicle operationsDocumentacionController- Handles documentation generation
/app/Http/Controllers/Directory Structure
Application Core (/app)
Database Layer (/database)
Resources (/resources)
Routes (/routes)
Route Structure
The application uses Laravel’s resource routing for RESTful operations:Resource controllers automatically handle standard CRUD operations (index, create, store, show, edit, update, destroy).
Authentication Flow
Laravel Fortify Integration
VIP2CARS uses Laravel Fortify for authentication, providing:- User registration
- Login/logout functionality
- Password reset
- Two-factor authentication (2FA)
- Email verification
Two-Factor Authentication
The system supports 2FA with the following features:- Secret key storage
- Recovery codes
- Confirmation timestamps
TwoFactorAuthenticatable trait in the User model.
Livewire Integration
Reactive Components
Livewire 4 is integrated for building reactive, dynamic interfaces without writing JavaScript:- Version: Livewire 4.0
- Location:
/app/Livewire/ - Components:
Logoutaction component
Flux UI Components
Flux UI (v2.9.0) provides pre-built UI components:- Custom icon components
- Navigation lists
- Form elements
- Layout components
Flux UI is Livewire’s official UI component library, providing beautiful, accessible components out of the box.
Service Providers
AppServiceProvider
Handles application-level service bindings and bootstrapping. Location:/app/Providers/AppServiceProvider.php
FortifyServiceProvider
Configures Laravel Fortify authentication features and customizations. Location:/app/Providers/FortifyServiceProvider.php
Design Patterns
Repository Pattern (Implicit)
Controllers interact directly with Eloquent models, following Laravel conventions:Action Pattern
Complex business logic is encapsulated in Action classes:CreateNewUser- User registration logicResetUserPassword- Password reset logic
Concerns (Traits)
Reusable functionality is extracted into traits:PasswordValidationRules- Password validation logicProfileValidationRules- Profile validation rules
Request Lifecycle
- HTTP Request arrives at
/public/index.php - Routing matches request to controller action
- Middleware processes authentication, CSRF, etc.
- Controller receives request
- Model interacts with database if needed
- View renders response with Blade templates
- Response sent back to client
Configuration
Configuration files are located in/config/ and include:
app.php- Application settingsdatabase.php- Database connectionsfortify.php- Authentication settingslivewire.php- Livewire configuration
Asset Compilation
The application uses Vite for asset compilation:- Configuration:
vite.config.js - Build Command:
npm run build - Dev Server:
npm run dev
Vite provides fast HMR (Hot Module Replacement) during development and optimized builds for production.
Testing Structure
Testing framework: Pest PHP 3.8Code Quality
Laravel Pint
Laravel Pint is configured for code formatting and linting:- Configuration:
pint.json - Run linter:
composer run lint - Check format:
composer run lint:check
Best Practices Implemented
- Separation of Concerns - Clear MVC boundaries
- RESTful Routing - Standard resource routes
- Eloquent Relationships - Proper model relationships
- Request Validation - Validation in controllers
- Mass Assignment Protection - Fillable properties defined
- Route Protection - Middleware for authentication
- Type Hinting - Strong typing throughout codebase