Write your own Application

Write your own Application

1. Write your own Application

Refreshed against dev-next. NMS Prime uses nwidart/laravel-modules v11-compatible module tooling.

This guide shows the modern path for creating a new NMS Prime module and a first CRUD resource.

1.1. Before you start

  • Read Architecture Guidelines

  • Confirm the feature belongs in a new or existing module

  • Plan bilingual UI strings for en and de

  • Plan web routes and API routes together

1.2. Create a module

php artisan module:make ExampleApp

This scaffolds a module under modules/ExampleApp/ using the project stubs in resources/views/vendor/module-stubs/.

1.3. Typical next steps

1.3.1. Add a model

php artisan module:make-model Widget ExampleApp

Place and refine the model under modules/ExampleApp/Entities. Models used by the shared admin CRUD stack should extend App\BaseModel and implement the view helpers expected by Base MVC, such as index labels and relation helpers.

1.3.2. Add a migration

Prefer a global migration:

php artisan make:migration create_widget_table

Then:

  • extend BaseMigration

  • set $migrationScope = 'database'

  • use singular table names and indexed foreign keys

php artisan migrate

1.3.3. Add a controller

php artisan module:make-controller WidgetController ExampleApp

Extend App\Http\Controllers\BaseController for standard CRUD resources.

1.3.4. Register routes

In the module route files:

  • web: use BaseRoute::resource(...)

  • api: add an apiResource (or equivalent module API route) so the resource is available over the API surface

1.3.5. Add UI

  • Use Base MVC generic views for standard admin CRUD

  • Use Livewire for new interactive panels and workflows

  • Keep strings in language files rather than hard-coding UI text

1.3.6. Add tests

  • Feature tests under modules/ExampleApp/Tests/Feature or global tests/Feature

  • Lifecycle tests for standard CRUD resources where applicable

  • Run php artisan test for the affected area

1.4. Checking whether a module is enabled

Prefer current module APIs such as:

if (\Module::collections()->has('ProvBase')) { // module is enabled } if (\Module::isEnabled('ProvVoipEnvia')) { // module is enabled }

Do not use obsolete PPModule / Pingpong Modules examples from older wiki pages.

1.5. Related pages