Files
BarangaySystem/ai-docs/files/viewHelperController.md
2026-06-06 18:43:00 +08:00

1.3 KiB

viewHelperController.php

Purpose

Central controller for page rendering and Vue component delivery. Handles both server-side rendering with templates and client-side SPA navigation.

Key Components

  • viewHelperController class
  • servePageFragmentUnified() method
  • getDefaultDataVariables() method
  • getAllViews() method

Exported Interfaces

  • servePageFragment() - Render page without template
  • servePageFragmentWithTemplate() - Render page with layout template
  • getDefaultDataVariables() - Get default view variables
  • getAllViews() - Get all available blade views

Inputs

  • $page - Page identifier (route name)
  • $data - Data payload for the page
  • $withTemplate - Boolean to include layout template

Outputs

  • HTML response with embedded navigation script
  • Base64-encoded HTML for SPA
  • View variables including currentUser and userModifyAdmin

Side Effects

  • Renders blade templates
  • Returns base64-encoded HTML for Vue navigation

Dependencies

  • App\Enums\UserTypes
  • Hypervel\Support\Facades\Auth, Response, File
  • App\Http\Controllers\Pages\Core\ApplicationController

Notes

  • Supports public and authenticated routes
  • Uses viewMap config for page-to-view mapping
  • Returns base64-encoded HTML for SPA navigation