Documentation Flow
Module Development Suite
CRM Module
Developer Guide
Comprehensive guide to building standardized CRM extensions. Follow the Polygon CLI protocol to maintain system architecture integrity.
1
Module Development Flow
Business Requirement
Database Design & Migration
Model & Controller Creation
Routes, Views & Menu JSON
Testing & Deployment
Live Example: Payment Module
Table
crm_payments
Model
Payment.php
Controller
PaymentController.php
Config
CRM manager.json
2
Database Migration & CLI
Standard Migration Path
modules/CRM/Database/Migrations/20260722_223938_CreatePaymentsTable.php
Terminal — Polygon Engine
$
php polygon.php make:migration CRM CreatePaymentsTable
# Result: Migration file generated successfully.
$
php polygon.php migrate
✓ Running module migrations...
✓ Migration completed.
✓ [crm_payments] table created successfully.
✓ Migration completed.
✓ [crm_payments] table created successfully.
4
Model Definition
Class Structure
class Payment extends Model { // Binding table protected string $table = 'crm_payments'; // Mass assignment guard protected array $fillable = [ 'payment_no', 'amount', 'payment_date' ]; }
5
Controller CLI
php polygon.php make:controller CRM PaymentController
Location: modules/CRM/Controllers/
6
Web Routes
/crm/payments
/crm/payments/create
/crm/payments/store
7
View Structure
index.php
create.php
edit.php
show.php
Optional: Service Layer
Business Logic
Mail / Payment Services
Third Party API Service
Completion Checklist
Migration Created & Run
Model & Fillable Defined
Controller Scaffolded
Views Directory Created
Menu JSON Configured
Permission Logic Tested
Enterprise Rules
Never Manually Create:
- Database Table
- Controller File
- Migration Filename
- Module Structure
Standard Workflow Sequence:
CLI Command → Migration → Model → Controller → Route → View → Menu JSON → Permission → Testing
Standard Framework Modules
CRM
ERP
POS
HRM
School ERP
Server Panel
SaaS Modules