Developer Menu 3/4

3. Laravel Project Structure for Developers

Understanding the project structure is crucial for efficient development and customization.

Directory Overview

web/
├── app/
│   ├── Constant/              # Enums/constants used across modules
│   ├── Contracts/             # Interface contracts
│   ├── Factory/               # Factory classes (e.g., payment gateway resolution)
│   ├── Filters/               # Query filters (API/event filtering)
│   ├── Gateways/              # Gateway integration classes
│   ├── Http/
│   │   ├── Controllers/
│   │   │   ├── Api/           # API controllers for mobile app
│   │   │   ├── Auth/          # Authentication controllers
│   │   │   ├── Backend/       # Admin panel controllers
│   │   │   ├── Organizer/     # Organizer-specific controllers
│   │   │   └── User/          # User management controllers
│   │   ├── Middleware/        # Custom middleware aliases and guards
│   │   └── Requests/          # Form request validation
│   ├── Models/                # Eloquent models
│   ├── Services/              # Business logic services
│   ├── Sections/              # Dynamic section/builder support
│   └── Traits/                # Reusable traits
├── bootstrap/
│   └── app.php                # Route registration + middleware aliases
├── database/
│   ├── migrations/            # Database schema migrations
│   └── seeders/               # Database seeders
├── routes/
│   ├── api.php               # API routes (mobile app)
│   ├── web.php               # Web routes (frontend)
│   ├── admin.php             # Admin panel routes
│   ├── organizer.php         # Organizer routes
│   ├── installer.php         # Installer routes
│   └── console.php           # Artisan/console route definitions
├── resources/
│   ├── views/
│   │   ├── backend/          # Admin panel views
│   │   ├── frontend/         # Frontend views
│   │   ├── organizer/        # Organizer panel views
│   │   ├── gateways/         # Gateway checkout views
│   │   └── components/       # Blade components
│   └── lang/                 # Language files
└── config/                   # Configuration files

Key Controllers

API Controllers (app/Http/Controllers/Api/)

  • RegistrationController.php - User authentication
  • EventController.php - Event management
  • PurchaseController.php - Ticket purchasing
  • CommonApiController.php - Shared API functionality

Backend Controllers (app/Http/Controllers/Backend/)

  • Dashboard/DashboardController.php - Admin dashboard
  • Users/ManageUserController.php - User management
  • Organizer/OrganizerController.php - Organizer management
  • Volunteer/VolunteerController.php - Volunteer management
  • Settings/SettingsController.php - System settings

Models (app/Models/)

Key models with their relationships:

  • User.php - User model with organizer capabilities
  • Event.php - Event model with ticket relationships
  • EventTicketType.php - Ticket types for events
  • TicketPurchase.php - Purchase records
  • Transaction.php - Financial transactions

Services (app/Services/)

Business logic separation:

  • Register/RegisterService.php - User registration logic
  • Gateway/ - Gateway configuration and gateway-level service logic
  • EventOrganizer/ - Organizer event/volunteer operations
  • PasswordReset/PasswordResetService.php - Password reset functionality

Routes Organization

Route files are registered in bootstrap/app.php. Admin, organizer, and installer routes are attached with explicit URL prefixes there.

API Routes (routes/api.php)

  • Public endpoints for event browsing
  • Authentication endpoints
  • Protected endpoints for authenticated users
  • Volunteer-specific endpoints

Admin Routes (routes/admin.php)

  • Admin panel functionality
  • User management
  • Event moderation
  • System settings

Organizer Routes (routes/organizer.php)

  • Event creation and management
  • Ticket sales monitoring
  • Customer communication

Installer Routes (routes/installer.php)

  • Installation wizard and environment/database setup
  • Guarded by installation middleware

Configuration Files

Key configuration files:

  • config/app.php - Application settings
  • config/database.php - Database configuration
  • config/sanctum.php - API token authentication settings
  • config/services.php - Third-party service settings
  • .env - Environment-specific settings

Where to Edit Common Features

  • New endpoint: routes/* + controller
  • New validation: app/Http/Requests
  • Business rules: app/Services
  • Data relation/fields: app/Models + migrations
  • Admin UI: resources/views/backend
  • Organizer UI: resources/views/organizer

Route Prefixes

  • /api from routes/api.php
  • /admin mapped in bootstrap/app.php to routes/admin.php
  • /organizer mapped in bootstrap/app.php to routes/organizer.php
  • /installer mapped in bootstrap/app.php to routes/installer.php