Skip to content

AuthorizationMiddleware ​

File: src/Http/Middleware/AuthorizationMiddleware.php
Alias: authorization
Part of: modularous.panel group

Shares authorization-related view data with the Blade master layout. Runs only on authenticated panel routes.

What It Does ​

Registers a view composer for modularous::layouts.master:

php
view()->composer('modularous::layouts.master', function ($view) {
    $view->with([
        'authorization'          => get_modularous_authorization_config(),
        'profileShortcutSchema'  => $profileShortcutSchema,
        'profileShortcutModel'   => $profileShortcutModel,
        'loginShortcutSchema'    => $loginShortcutSchema,
        'loginShortcutModel'     => [],
    ]);
});
VariableSourceDescription
authorizationget_modularous_authorization_config()Role/permission config used to control UI visibility
profileShortcutSchemagetFormDraft('profile_shortcut')Form schema for the profile quick-edit panel
profileShortcutModelUserRepository::getFormFields($user, $schema)Current user's profile field values
loginShortcutSchemagetFormDraft('login_shortcut')Form schema for the login shortcut widget
loginShortcutModel[]Empty — populated client-side

Notes ​

  • This middleware only affects Blade-rendered pages. For Inertia pages, authorization data is shared via HandleInertiaRequests::share() under the authorization prop.
  • The UserRepository is resolved fresh on each request to ensure the profile model reflects the current authenticated state (including impersonation).