Developer Documentation

Advanced Developer Guide

Complete internal architecture, complex system workflows, database layers, and deployment specifications.

System Architecture

The system is engineered on enterprise patterns leveraging high-performance layers for scalability:

  • Laravel 10 core Framework with MVC decoupling.
  • Service Layer Pattern isolating business workflows logic entirely away from Controllers.
  • Repository Pattern for structured DB querying layer abstractions.
  • Blade Engine + Livewire asynchronous hydration for real-time dashboard responsiveness.
app/ ├── Http/Controllers # Light controllers managing requests/responses ├── Models # Database schemas, relational mappings & Eloquent logic ├── Services # Core business logic processing layers (NocService, etc.) ├── Repositories # Data access isolation layer abstracts └── Classes # Shared core helpers, third-party wrappers, and macro functions

Core Workflow Logic

Visual map describing internal tracking mechanism lifecycles across desk routes:

Application Submitted ──> Logged into Incoming Dak │ ▼ Forwarded to Officer (Dynamic tracking assignment) │ ▼ Nothi Processing Layer (Live notes + Multi-attachments attachment) │ ▼ Approval Chain Processing (Multi-cycle condition checks) │ ▼ Letter Auto-Drafting Module (MPDF Rendering) │ ▼ Final Approved & Certificate Generated
  • Dynamic Routing Chain: Real-time desk assignments via model bindings.
  • Multi-cycle Checkpoints: State machines track current revisions/returns safely.
  • Digital Footprint Signing: Secure hash generation for certificate validation.

Core Framework Dependencies

Laravel Sanctum

Lightweight Token guard authentication for SPA/API layers.

Docs

Livewire 3.x

Asynchronous dynamic single-page reactivity mappings seamlessly.

Docs

Laratrust

Granular RBAC model managing matrix level permissions.

Docs

MPDF Wrapper

Complex Unicode-compliant PDF document compilation engine.

Docs

Simple QR Code

Generates high-density vector matrix hashes instantly for live verifications.

Docs

System Route & Endpoint Registries

All core operation instances execute under specific pipeline configurations protected via stateless middleware filters.

Payment Gateway Endpoints

Method Endpoint URI Operational Scope
GET /payment/initiate/temp/{id} Instantiates session tokens with explicit dynamic hooks.
POST /payment/success Handles gateway callback pipeline verification requests.
POST /payment/fail Terminates current transaction context states gracefully.
POST /payment/cancel Reverts back to client checkout entry contexts cleanly.

Betterment & Financial Ledger Routing

Method Endpoint URI Operational Scope
POST /betterment/online/{application}/{letter} Triggers synchronous digital balance calculation processes.
POST /betterment/bank/invoice/{letter} Generates database references for bank-teller sync ledgers.
GET /betterment/bank/invoice/pdf/{payment} Streams calculated transaction slips into client browsers via stream engines.

Authenticated Core Middleware Isolation

Critical business mutations run strictly wrapped inside validation structures:

Route::middleware(['auth:sanctum', 'track.activity'])->group(function () { Route::prefix('noc-applications')->group(function () { Route::get('/', [NocApplicationController::class, 'index']); Route::post('/', [NocApplicationController::class, 'store']); Route::get('/{id}', [NocApplicationController::class, 'show']); Route::put('/{id}', [NocApplicationController::class, 'update']); Route::delete('/{id}', [NocApplicationController::class, 'destroy']); }); });

NOC Process Flow Controls

Method Endpoint URI Operational Scope
POST /noc-approval/{id}/approve Executes atomic authorization signatures on targeted items.
POST /noc-approval/forward/{id} Dispatches target file entity ownerships down the desk tree hierarchy.
POST /noc-approval/submit-note Appends thread objects permanently to timeline arrays.

Reporting Engine Layer

Endpoint URI Operational Scope
/report/noc-details Queries historical lifecycle data utilizing efficient index cursors.
/report/payment-details Aggregates systemic collection values filtering out aborted transactions.
/report/monthly Provides raw analytical datasets tailored specifically for charts components.
Architecture Specification Note: This application does not operate as a pure stateless REST API interface. It blends structural route controllers, server hydrated Livewire models, and synchronous Eloquent models to securely handle complex governmental desk flows safely.

Database Schema Schematics

Relational maps optimized with proper multi-column indexes for handling thousands of concurrent applications smoothly:

Target Database Table Structural Responsibility Inside Context
noc_applications Stores main application records, applicant metadata, and root entity payloads.
noc_approvals Tracks the detailed history of the workflow states, desk routes, and decision flags.
noc_letters Maintains generated dispatch templates, reference configurations, and template bindings.
noc_application_archives Acts as a directory tracking references to long-term digital file uploads.
nothi_nisponnos Houses permanent system archives once an application reaches its ultimate resolution state.
plot_applications Manages property assignments, dimension metrics, and map polygon keys.
meetings Schedules panel reviews and auto-compiles resolution agendas.
payments Financial logs mapping gateway references with unique system application IDs.

Core Asynchronous Livewire Modules

These reactive single-file architecture modules skip full browser reloads, processing DOM updates efficiently via ajax engines:

  • Market Management Module: Dynamically recalculates rent rates and lease terms.
  • Residential Plot Module: Real-time plot allocation checking and layout grid rendering.
  • Store & Payment Module: Updates payment status flags instantly upon gateway callback hits.
  • Report Dashboard Module: Processes multi-million rows utilizing database chunk cursors.
// Core reactive component routing definitions Route::get('/market/store', StoreModule::class); Route::get('/report/payment', ReportModule::class);

Role-Based Access Controls (RBAC)

Granular access control policies matrix enforced via Laratrust trait interceptors:

  • Super Admin: Full root privileges bypasses all global scope authorization blocks.
  • Admin: Accessible to data views, ledger processing engines, and report monitors.
  • Officer: Workflow execution scopes, note generation, and approval routing signatures.
  • User: Read-only application tracking bounds, secure uploads, and transaction interfaces.
if (auth()->user()->hasPermission('approve.noc')) { // Interceptor verifies ACL matrix before triggering state modification pipelines $service->finalizeApproval($applicationId); }

Document & Asset Management Layer

All client file streams route securely through dedicated disk strategies to isolate assets from unauthorized web paths:

  • Saved strictly inside protected directories: storage/app/public/noc/.
  • Enforces rigid MIME validation layers (Strictly application/pdf limits).
  • File naming conventions are completely sanitized via cryptographically secure UUIDv4 formats.
$fileName = Str::uuid() . '.pdf'; $request->file('doc')->storeAs('noc', $fileName, 'public');

Notifications & Event Dispatchers

Engineered entirely on non-blocking async event handlers to optimize application response runtimes:

  • SMS Gateways: Triggers notifications instantly during workflow milestones.
  • Mail Subsystems: Dispatches printable invoices and links seamlessly using system templates.
event(new ApplicationSubmitted($application)); // Detached event tracking fires independent notification channels out-of-process

Performance Optimization Layer

Mandatory implementation procedures to guarantee sub-second server execution runtimes:

  • Eager Loading: Forces model relations into singular batch operations to eliminate N+1 query patterns.
  • Chunk Processing: Stream records sequentially via cursors during heavy reports exports.
# Clear and rebuild application optimization caches in production environments php artisan optimize:clear

System Audit Logging

Ensures legal accountability across desk routes by recording all state mutations:

Log::info('Application Approved', [ 'user_id' => auth()->id(), 'application_id' => $id, 'ip_address' => request()->ip(), 'timestamp' => now()->toIso8601String() ]);

Transaction Integrity & Exception Management

Critical business operations execute safely inside try-catch transaction structures to guarantee total data rollbacks on failures:

DB::beginTransaction(); try { $application->update(['status' => 'approved']); Approval::create([ 'application_id' => $application->id, 'status' => 'approved' ]); DB::commit(); } catch (\Exception $e) { DB::rollBack(); Log::error('Approval Failure Routine: ' . $e->getMessage()); throw new WorkflowException("State transition failed."); }

Production Deployment & Verification

Standard checklist pipeline for deploying structural changes to the live infrastructure server:

# 1. Run migrations safely via force execution hooks php artisan migrate --force # 2. Compile system cache files to save file-system search cycles php artisan config:cache php artisan route:cache php artisan view:cache

Recommended Stack Components: Nginx Reverse Proxy + PHP 8.2-FPM + MySQL 8 + Redis Cache Store.