Skip to content

HandleInertiaRequests ​

File: src/Http/Middleware/HandleInertiaRequests.php
Alias: inertia.middleware (singleton)
Extends: Inertia\Middleware

The central Inertia middleware that establishes the root Blade view and populates the shared props passed to every Vue page component on every request.

Root View ​

php
protected $rootView = 'modularous::layouts.app-inertia';

Shared Props ​

All props returned by share() are available in every Vue page via usePage().props:

auth ​

js
{ user: { ...userObject } }

flash ​

Lazy-loaded flash messages from the session:

js
{ message: '...', success: '...', error: '...' }

config ​

js
{ app_name: '...', js_namespace: '...', timezone: '...' }

endpoints ​

Custom per-request endpoint map set via $request->attributes->set('endpoints', [...]) in controllers.

authorization ​

Resolved per request from the authenticated user:

KeyTypeDescription
isSuperAdminbool$user->is_superadmin
isClientbool$user->isClient()
is_clientbool$user->is_client
hasRestorableboolSoft-delete restore capability
hasBulkableboolBulk action capability
permissionsstring[]All permission names
rolesstring[]All role names

Returns [] for unauthenticated requests.

storeData ​

Initialisation data for the Pinia/Vuex store, split into sub-objects:

KeyContents
configSidebar, topbar, bottomNav options; UI preferences; endpoints
userProfile, routes, shortcut schemas
mediasMedia library types (images + files), crop config
languagesAll languages, active language
formBase URL, initial inputs
datatableAdvanced filters, custom modal flag
ambientEnvironment, app name/email/debug, package versions

Media Types ​

getMediaTypes() adds entries for enabled libraries:

Module flagEntry added
enabled.media-libraryImages type with media-library.media.index endpoint
enabled.file-libraryFiles type with file-library.file.index endpoint

Notes ​

  • version() delegates to the parent Inertia middleware, which hashes the mix-manifest.json or Vite manifest for asset versioning.
  • getLanguages() and getActiveLanguage() return empty arrays by default — override in an app-level middleware extension to plug in your translation/locale system.