Home
NexoPOS

BeforeStartWebRouteEvent

BeforeStartWebRouteEvent is dispatched while NexoPOS starts loading web routes. Modules can use it to register web routes or run setup that must happen before the main web route definitions are loaded.

Where It Runs

This event is dispatched in routes/web.php before NexoPOS includes the main web route definitions.

Available Properties

  • This event does not expose constructor properties. It is used as a lifecycle signal while route files are being loaded.

Listener Example

<?php

use App\Events\BeforeStartWebRouteEvent;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Route;

Event::listen( BeforeStartWebRouteEvent::class, function () {
    Route::prefix( 'my-module' )->group( function () {
        Route::get( 'status', fn () => [ 'status' => 'ok' ] );
    } );
} );

Summary

  • Use this event when a module needs to register routes during the matching route bootstrapping phase.
  • Register only the routes that belong to the current route file context.