354 lines
12 KiB
Markdown
354 lines
12 KiB
Markdown
# Project Structure - Laravel Portal
|
|
|
|
## 📊 Project Overview
|
|
|
|
| Metric | Count |
|
|
|--------|-------|
|
|
| **Models** | 61 |
|
|
| **Controllers** | 46 |
|
|
| **Migrations** | 90 |
|
|
| **Views** | 311 |
|
|
| **Repositories** | 153 |
|
|
| **Routes** | 7 |
|
|
|
|
---
|
|
|
|
## 🗂️ Directory Structure
|
|
|
|
```
|
|
portal/
|
|
├── app/
|
|
│ ├── Console/ # Artisan commands
|
|
│ │ ├── Commands/
|
|
│ │ └── Kernel.php
|
|
│ │
|
|
│ ├── Enums/ # Enum classes
|
|
│ │ ├── Order/
|
|
│ │ ├── Product/
|
|
│ │ ├── Client/
|
|
│ │ └── Invoice/
|
|
│ │
|
|
│ ├── Events/ # Event classes
|
|
│ │
|
|
│ ├── Exceptions/ # Exception handlers
|
|
│ │
|
|
│ ├── Exports/ # Excel exports
|
|
│ │
|
|
│ ├── Helpers/ # Helper functions
|
|
│ │
|
|
│ ├── Http/
|
|
│ │ ├── Controllers/
|
|
│ │ │ ├── admin/ # Admin controllers
|
|
│ │ │ │ ├── ModulevCenterController.php
|
|
│ │ │ │ ├── ModuleHostingController.php
|
|
│ │ │ │ ├── CustomerController.php
|
|
│ │ │ │ ├── OrderController.php
|
|
│ │ │ │ ├── InvoiceController.php
|
|
│ │ │ │ ├── UserController.php
|
|
│ │ │ │ ├── AddonController.php
|
|
│ │ │ │ ├── TemplateController.php
|
|
│ │ │ │ ├── SupportController.php
|
|
│ │ │ │ ├── package/ # Package modules
|
|
│ │ │ │ │ ├── Datacenter.php
|
|
│ │ │ │ │ ├── Host.php
|
|
│ │ │ │ │ ├── Datastore.php
|
|
│ │ │ │ │ ├── Network.php
|
|
│ │ │ │ │ ├── Folder.php
|
|
│ │ │ │ │ ├── Group.php
|
|
│ │ │ │ │ ├── IPMapping.php
|
|
│ │ │ │ │ ├── OsVersion.php
|
|
│ │ │ │ │ └── vm/
|
|
│ │ │ │ │ └── VirtualMachineController.php
|
|
│ │ │ │ ├── product/
|
|
│ │ │ │ ├── vm/
|
|
│ │ │ │ └── Api/ # API controllers
|
|
│ │ │ └── rest/
|
|
│ │ ├── Middleware/ # Custom middleware
|
|
│ │ ├── Requests/ # Form requests
|
|
│ │ ├── Services/ # Services
|
|
│ │ │ ├── vCenter/
|
|
│ │ │ │ ├── Client.php
|
|
│ │ │ │ ├── PowerShellService.php
|
|
│ │ │ │ ├── SnapshotService.php
|
|
│ │ │ │ ├── VirtualMachineService.php
|
|
│ │ │ │ └── ...
|
|
│ │ │ ├── Upload.php
|
|
│ │ │ └── ...
|
|
│ │ ├── Kernel.php
|
|
│ │ └── ...
|
|
│ │
|
|
│ ├── Imports/ # Excel imports
|
|
│ │
|
|
│ ├── Jobs/ # Queue jobs
|
|
│ │ ├── Hosting/
|
|
│ │ ├── Mail/
|
|
│ │ ├── Payment/
|
|
│ │ ├── Ticket/
|
|
│ │ └── VirtualMachine/
|
|
│ │ └── Sync/
|
|
│ │ ├── SyncDatacenter.php
|
|
│ │ ├── SyncHost.php
|
|
│ │ ├── SyncDatastore.php
|
|
│ │ ├── SyncNetwork.php
|
|
│ │ ├── SyncFolder.php
|
|
│ │ └── SyncAllPackage.php
|
|
│ │
|
|
│ ├── Mail/ # Mails
|
|
│ │ └── Customer/
|
|
│ │
|
|
│ ├── Models/ # Eloquent models (61 files)
|
|
│ │ ├── User.php
|
|
│ │ ├── Customer.php
|
|
│ │ ├── Staff.php
|
|
│ │ ├── Order.php
|
|
│ │ ├── Invoice.php
|
|
│ │ ├── Product.php
|
|
│ │ ├── Hosting.php
|
|
│ │ ├── vCenter.php
|
|
│ │ ├── ModuleDatacenter.php
|
|
│ │ ├── ModuleHost.php
|
|
│ │ ├── ModuleDatastore.php
|
|
│ │ ├── ModuleNetwork.php
|
|
│ │ ├── ModuleFolder.php
|
|
│ │ ├── VirtualMachines.php
|
|
│ │ └── ...
|
|
│ │
|
|
│ ├── Notifications/
|
|
│ │
|
|
│ ├── Observers/ # Model observers
|
|
│ │
|
|
│ ├── Providers/ # Service providers
|
|
│ │ ├── AppServiceProvider.php
|
|
│ │ ├── AuthServiceProvider.php
|
|
│ │ ├── RouteServiceProvider.php
|
|
│ │ └── ...
|
|
│ │
|
|
│ ├── Repositories/ # Repository pattern (153 files)
|
|
│ │ ├── vCenter/
|
|
│ │ │ ├── vCenterRepository.php
|
|
│ │ │ ├── vCenterCachedRepository.php
|
|
│ │ │ └── vCenterRepositoryInterface.php
|
|
│ │ ├── Module/
|
|
│ │ │ ├── Datacenter/
|
|
│ │ │ ├── Host/
|
|
│ │ │ ├── Datastore/
|
|
│ │ │ ├── Network/
|
|
│ │ │ ├── Folder/
|
|
│ │ │ ├── IpAddress/
|
|
│ │ │ ├── VirtualMachine/
|
|
│ │ │ ├── Hosting/
|
|
│ │ │ ├── HostingServer/
|
|
│ │ │ ├── DnsServer/
|
|
│ │ │ ├── Domain/
|
|
│ │ │ ├── IPPool/
|
|
│ │ │ └── Snapshot/
|
|
│ │ ├── User/
|
|
│ │ ├── Order/
|
|
│ │ ├── Invoice/
|
|
│ │ ├── Product/
|
|
│ │ ├── Admin/
|
|
│ │ └── ...
|
|
│ │
|
|
│ ├── Services/
|
|
│ │
|
|
│ ├── Support/
|
|
│ │
|
|
│ ├── Traits/
|
|
│ │
|
|
│ └── View/
|
|
│ └── Components/ # Blade components
|
|
│ └── Module/
|
|
│
|
|
├── bootstrap/
|
|
│ ├── app.php
|
|
│ ├── cache/
|
|
│ └── providers.php
|
|
│
|
|
├── config/ # Configuration files (33 dirs)
|
|
│ ├── app.php
|
|
│ ├── auth.php
|
|
│ ├── cache.php
|
|
│ ├── database.php
|
|
│ ├── filesystems.php
|
|
│ ├── logging.php
|
|
│ ├── mail.php
|
|
│ ├── queue.php
|
|
│ ├── session.php
|
|
│ ├── queue.php
|
|
│ └── ...
|
|
│
|
|
├── database/
|
|
│ ├── factories/
|
|
│ ├── migrations/ # 90 migration files
|
|
│ │ ├── 2024_01_31_165959_module_hosting_server.php
|
|
│ │ ├── 2024_02_01_080844_module_hosting.php
|
|
│ │ ├── 2024_02_01_082942_v_center.php
|
|
│ │ ├── 2024_02_01_090134_module_datacenter.php
|
|
│ │ ├── 2024_02_01_090537_module_host.php
|
|
│ │ ├── 2024_02_01_091327_module_folder.php
|
|
│ │ ├── 2024_02_01_091707_module_datastore.php
|
|
│ │ ├── 2024_02_01_092104_module_network.php
|
|
│ │ └── ...
|
|
│ └── seeders/
|
|
│
|
|
├── docs/
|
|
│
|
|
├── lang/ # Language files
|
|
│ ├── en/
|
|
│ └── vi/
|
|
│
|
|
├── public/ # Public assets
|
|
│ ├── assets/
|
|
│ ├── css/
|
|
│ ├── js/
|
|
│ ├── images/
|
|
│ ├── build/
|
|
│ ├── libraries/
|
|
│ └── index.php
|
|
│
|
|
├── resources/
|
|
│ ├── views/
|
|
│ │ ├── administrator/ # Admin views
|
|
│ │ │ ├── layout/
|
|
│ │ │ ├── pages/
|
|
│ │ │ │ ├── module/ # Module pages
|
|
│ │ │ │ │ ├── vcenter/
|
|
│ │ │ │ │ ├── hosting/
|
|
│ │ │ │ │ └── ippool/
|
|
│ │ │ │ ├── package/ # Package pages
|
|
│ │ │ │ │ ├── vcenter/
|
|
│ │ │ │ │ ├── datacenter/
|
|
│ │ │ │ │ ├── host/
|
|
│ │ │ │ │ ├── datastore/
|
|
│ │ │ │ │ ├── network/
|
|
│ │ │ │ │ ├── folder/
|
|
│ │ │ │ │ ├── vm/
|
|
│ │ │ │ │ ├── group/
|
|
│ │ │ │ │ ├── ipaddress/
|
|
│ │ │ │ │ └── version/
|
|
│ │ │ │ ├── customer/
|
|
│ │ │ │ ├── order/
|
|
│ │ │ │ ├── invoice/
|
|
│ │ │ │ ├── product/
|
|
│ │ │ │ └── ...
|
|
│ │ │ └── blocks/
|
|
│ │ ├── components/ # Blade components
|
|
│ │ ├── livewire/ # Livewire components
|
|
│ │ ├── emails/ # Email templates
|
|
│ │ ├── form/
|
|
│ │ ├── vendor/
|
|
│ │ └── errors/
|
|
│ ├── js/
|
|
│ ├── css/
|
|
│ └── sass/
|
|
│
|
|
├── routes/
|
|
│ ├── admin.php # Admin routes (30,829 bytes)
|
|
│ ├── api.php # API routes
|
|
│ ├── web.php # Web routes
|
|
│ ├── client.php # Client routes
|
|
│ ├── administrator.php
|
|
│ ├── channels.php
|
|
│ └── console.php
|
|
│
|
|
├── scripts/
|
|
│
|
|
├── storage/
|
|
│ ├── app/
|
|
│ ├── framework/
|
|
│ │ ├── cache/
|
|
│ │ ├── sessions/
|
|
│ │ └── views/
|
|
│ └── logs/
|
|
│
|
|
├── tests/
|
|
│ ├── Feature/
|
|
│ ├── Unit/
|
|
│ └── ...
|
|
│
|
|
├── vendor/ # Composer dependencies
|
|
│
|
|
├── .env # Environment config
|
|
├── .env.example
|
|
├── artisan
|
|
├── composer.json
|
|
├── package.json
|
|
├── vite.config.js
|
|
├── webpack.mix.js
|
|
├── docker-compose.yml
|
|
└── INFRASTRUCTURE_ACTION_ITEMS.md
|
|
```
|
|
|
|
---
|
|
|
|
## 🏗️ Architecture Overview
|
|
|
|
### Pattern: Repository Pattern
|
|
```
|
|
Controller → Repository Interface → Repository → Model
|
|
```
|
|
|
|
### Key Modules
|
|
|
|
| Module | Purpose | Key Files |
|
|
|--------|---------|-----------|
|
|
| **vCenter Management** | Connect & manage vCenter servers | vCenter.php, ModulevCenterController |
|
|
| **Infrastructure** | Datacenter, Host, Datastore, Network, Folder | Module* models, package/* controllers |
|
|
| **Virtual Machines** | VM lifecycle management | VirtualMachines.php, Sync* jobs |
|
|
| **Orders & Billing** | Order processing, Invoices | Order.php, Invoice.php |
|
|
| **Customer Management** | Customer accounts, Auth | Customer.php, CustomerController |
|
|
| **Hosting** | Hosting services | ModuleHosting.php, Hosting.php |
|
|
|
|
---
|
|
|
|
## 🎨 Tech Stack
|
|
|
|
- **Backend**: Laravel 10.x
|
|
- **Frontend**: Bootstrap 5, jQuery AJAX, Livewire
|
|
- **Database**: MySQL
|
|
- **Cache**: Redis
|
|
- **Queue**: Database/Broadcast (laravel-echo-server)
|
|
- **Auth**: Session-based + Sanctum for API
|
|
|
|
---
|
|
|
|
## 📁 Key Configuration Files
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| `config/app.php` | App name, locale, timezone |
|
|
| `config/database.php` | MySQL connection |
|
|
| `config/cache.php` | Redis cache config |
|
|
| `config/queue.php` | Queue connection |
|
|
| `config/sanctum.php` | API auth |
|
|
| `routes/admin.php` | All admin routes (~30KB) |
|
|
|
|
---
|
|
|
|
## 🔗 Route Structure (routes/admin.php ~575 lines)
|
|
|
|
```
|
|
/admin
|
|
├── /vcenter → ModulevCenterController
|
|
├── /module
|
|
│ ├── /dns → ModuleDNSController
|
|
│ ├── /hosting → ModuleHostingController
|
|
│ └── /ippool → ModuleIPPoolController
|
|
├── /package
|
|
│ ├── /datacenter → DatacenterController
|
|
│ ├── /host → HostController
|
|
│ ├── /datastore → DatastoreController
|
|
│ ├── /network → NetworkController
|
|
│ ├── /folder → FolderController
|
|
│ ├── /vm → VirtualMachineController
|
|
│ └── ...
|
|
├── /customer → CustomerController
|
|
├── /order → OrderController
|
|
├── /invoice → InvoiceController
|
|
└── ...
|
|
```
|
|
|
|
---
|
|
|
|
*Generated: Mar 2026*
|