Skip to content

System Module

Overview

The System module is the administrative backbone of the Sutomo platform. It provides the foundational services and configurations that every other module depends on — settings management, access control, audit logging, approval workflows, asset management, master data, and contact encryption.

Unlike domain-specific modules (Hiring, Academic, Financial), the System module is cross-cutting: its services are consumed by all other modules. It ensures consistent configuration, security, and observability across the entire application.

Key Entities

EntityModuleDescription
SettingGeneralKey-value configuration store organized by module, group, and key with caching.
Role & PermissionRBACAccess control via Spatie Permission / Filament Shield.
Activity LogGeneralPolymorphic audit trail for all model creates, updates, and deletes.
ApprovalGeneralPolymorphic workflow approval — role-based and user-based approvers.
AssetGeneralFile/media storage abstraction (local disk, ImageKit).
ContactGeneralEncrypted contact storage with censored display support.
Master DataGeneralGenders, Ethnicities, Religions, Localizations.

Concept

The System module operates on several key principles:

1. Centralized Configuration

All settings are stored in a single settings table with a module / group / key hierarchy. This allows any part of the system — from mail configuration to theme presets — to be managed through a consistent interface. The Setting model includes automatic caching (60-minute TTL) and type casting (boolean, integer, json, string).

2. Polymorphic Architecture

Both Activity Logs and Approvals use polymorphic relationships (morphMany). This means any model in the system can be logged or approved without modifying the System module — simply apply the HasLog trait or the Approval trait.

3. Role-Based Access Control (RBAC)

The system uses Filament Shield which wraps Spatie Permission. Permissions follow a naming convention: {action}{Resource}:{Module} (e.g., ViewGeneral:SystemSetting, EditMail:SystemSetting). Each Filament resource/page declares its required permissions. See RBAC for details.

4. Secure Contact Storage

Contacts are encrypted at rest using Laravel's encryption. A censored column stores a display-safe version (e.g., user***@***.com), while the full value is stored encrypted in the encrypted column.


Sub-Modules

  • General — Settings management, activity logs, approvals, assets, contacts, master data
  • RBAC — Roles, permissions, authorization flows

Key Files

app/
├── Models/Platform/
│   ├── Setting/Setting.php              # Key-value store with caching
│   ├── ActivityLog/ActivityLog.php       # Polymorphic audit trail
│   ├── Approval/Approval.php             # Workflow approval system
│   ├── Asset/Asset.php                   # File/media storage abstraction
│   ├── Contact/Contact.php               # Encrypted contact storage
│   ├── Gender/Gender.php                 # Gender reference data
│   ├── Ethnicity/Ethnicity.php           # Ethnicity reference data
│   ├── Religion/Religion.php             # Religion reference data
│   └── Localization/Localization.php     # Locale/language reference data

├── Traits/Common/
│   ├── HasLog.php                        # Auto-logging on model events
│   ├── HasAsset.php                      # Asset relationship trait
│   └── HasContact.php                    # Contact relationship trait

├── Services/Asset/
│   ├── AssetService.php                  # Asset upload/delete/render
│   └── ImageKitService.php               # ImageKit cloud provider

├── Filament/Clusters/SystemSettings/     # Admin settings UI
│   └── Pages/
│       ├── ManageGeneralSettings.php     # General system settings
│       └── ManageMailSettings.php        # Mail/email configuration

└── database/migrations/
    └── v1_0_0/
        └── 001_migrate_platform.php      # Platform tables creation