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
syncdriver). - Local Server: Laravel Herd (Recommended) or Valet / Docker.
2. Installation
Clone the Repository
bashgit clone https://github.com/olow-erp/core.git hotels cd hotelsInstall Dependencies
bashcomposer install npm installEnvironment Setup
bashcp .env.example .env php artisan key:generateEdit
.envand set your database credentials.Database Migration & Seed
bashphp artisan migrate php artisan db:seedThis creates the default Super Admin and a Demo Property.
Build Frontend
bashnpm run dev
3. Development Workflow
Creating a New Module
- Create folder
app/Domain/NewModule. - Create
Models/,Services/,Enums/directories. - All models must use the
BelongsToPropertytrait for tenant isolation. - Financial modules must use
AccountingMapService+AccountingKeyenum (never hardcode GL account IDs). - Create a route file at
routes/modules/newmodule.phpand include it inroutes/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 athttp://localhost:5173) - Build:
npm run docs:build - Source Files:
docs/new/