Skip to content

Developer Onboarding Guide

1. Prerequisites

  • PHP: 8.2 or higher.
  • Composer: Latest version.
  • Node.js: v20+.
  • Database: MySQL 8.0+ or MariaDB.
  • Redis: For queues (optional for local dev, can use sync driver).
  • Local Server: Laravel Herd (Recommended) or Valet / Docker.

2. Installation

  1. Clone the Repository

    bash
    git clone https://github.com/olow-erp/core.git hotels
    cd hotels
  2. Install Dependencies

    bash
    composer install
    npm install
  3. Environment Setup

    bash
    cp .env.example .env
    php artisan key:generate

    Edit .env and set your database credentials.

  4. Database Migration & Seed

    bash
    php artisan migrate
    php artisan db:seed

    This creates the default Super Admin and a Demo Property.

  5. Build Frontend

    bash
    npm run dev

3. Development Workflow

Creating a New Module

  1. Create folder app/Domain/NewModule.
  2. Create Models/, Services/, Enums/ directories.
  3. All models must use the BelongsToProperty trait for tenant isolation.
  4. Financial modules must use AccountingMapService + AccountingKey enum (never hardcode GL account IDs).
  5. Create a route file at routes/modules/newmodule.php and include it in routes/admin.php.

Code Style

  • PSR-12: We follow standard PHP styling.
  • Type Hinting: Strictly type all method arguments and return values.
  • DocBlocks: Use them for complex logic, but prefer self-documenting code.

Testing

  • Framework: PestPHP.
  • Run Tests: php artisan test.
  • Policy: Write tests for all critical Service methods (Money handling, Status transitions).

4. Common Tasks

Creating a Migration

Use the module path:

bash
php artisan make:migration create_new_tables --path=database/migrations/NewModule

(Note: Currently migrations are flat in database/migrations, but moving to module-folded is planned).

Accessing the App (Local Dev with Herd)

  • Tenant Admin: {subdomain}.hotels.test/admin (e.g., demo.hotels.test/admin)
  • Guest Portal: {subdomain}.hotels.test (e.g., demo.hotels.test)
  • Super Admin: {subdomain}.hotels.test/platform
  • Marketing: hotels.test (main domain)
  • Login (Staff): admin@olow.com / password

Multi-Tenancy Local Setup

Configure Herd to route *.hotels.test to your project. Each property's subdomain field maps to the first part of the hostname.

5. Documentation

We use VitePress for documentation.

  • Run Locally: npm run docs:dev (Starts at http://localhost:5173)
  • Build: npm run docs:build
  • Source Files: docs/new/