In this section · 4 articles

Create a new module shell

Start a new add-on from the Scaffolder: preview the empty module (its manifest, providers, routes, permissions seeder and menu file), create it, and turn it on.

Applies to
Stub Generator 1.0 and later
Who can do this
Developer
Permission
feature.stubgen.scaffolder.generate
Where
Scaffolder (Platform Administration)
On this page

A module shell is an empty add-on with everything a Laramin module needs to load, and no screens yet. The Scaffolder builds it with the same generator as Core's php artisan laramin:make-module command. You then add screens to it in Resource mode.

Danger: Create module writes a new folder into the code of the Laramin you're signed in to, on its server. Use it only on a development copy that's under version control, never on your live Laramin.

Before you start

  • You need Use Scaffolder (feature.stubgen.scaffolder.view) to preview, and Generate Scaffold (feature.stubgen.scaffolder.generate) to create.
  • The web server must be able to write to the Modules/ folder.
  • Running the next steps needs command-line access to the server.

Steps

  1. In the Platform Administration sidebar, select Scaffolder.

  2. Switch the mode to New module.

  3. Under New module shell, enter the Module name, such as Inventory. Use letters and digits only, starting with a letter. The name is turned into StudlyCase, so inventory becomes Inventory.

  4. Optional: enter an Abbreviation, in lowercase letters and digits, such as inv. It's used in permission keys (feature.inv.…) and as the table prefix. Leave it empty to use the first three letters of the name.

  5. Select Preview and check the files.

  6. Select Create module.

  7. In Create module, select Create module again.

    The Create module confirmation dialog asking to create a new module shell at Modules/Inventory, with the red Create module button highlighted next to Cancel.

The Result card shows Files generated successfully. and lists the files written.

If the module already exists, you see "Module [Inventory] already exists." To replace its shell files, turn on Overwrite existing files and try again. Files you've added since aren't touched, but overwritten shell files lose your changes. To add a screen to an existing module, switch to Resource mode instead.

What happens next

Careful: In Stub Generator 1.1.0, these steps don't turn the shell on yet. The shell doesn't appear in Addons, and php artisan module:enable stops with Module [Inventory] does not exist! See The Scaffolder shows warnings, or what it made doesn't appear.

The Result card lists these Next steps, to run on the server in your Laramin's folder:

  1. composer dump-autoload
  2. php artisan module:enable Inventory, with your module's name.
  3. php artisan permission:sync --module=Inventory --force
  4. php artisan optimize:clear

Then switch to Resource mode and generate the module's first screen. See Generate a resource with the Scaffolder.

Tip: The line under the buttons shows the matching command, such as php artisan laramin:make-module Inventory --abbr=inv, if you'd rather create the module from the command line.