In this section · 4 articles

The Scaffolder shows warnings, or what it made doesn't appear

The result lists syntax errors or a marker warning, every file is skipped, a new screen has no menu entry, or a new module shell can't be turned on. What each one means and what to do.

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

Symptom

One of these:

What you seeGo to
You can't find Scaffolder, or there's no Generate button1
Generated with warnings — review the result below., with Syntax errors in generated files2
A warning that starts Could not inject routes into (or policies, or permissions) and ends (marker not found). Add manually:3
Every file is skipped, with Existing files were left untouched. Enable “Overwrite existing files” to replace them.4
A new screen has no menu entry, or doesn't open5
A new module shell isn't in Addons, and module:enable says Module [Inventory] does not exist!6

Check these, in order

1. You can't find the Scaffolder, or can't generate

The Scaffolder is only in the Platform Administration sidebar, under Addons, and needs Use Scaffolder (feature.stubgen.scaffolder.view). Without Generate Scaffold (feature.stubgen.scaffolder.generate), you can preview, but the Generate and Create module buttons aren't shown.

Fix: Switch to Platform Administration, and ask a super admin for the permission you're missing. Or write the files with the command shown under the buttons.

2. The result lists syntax errors

After writing the files, the Scaffolder checks each PHP file with the PHP program that runs your Laramin's website, and lists every file that check doesn't pass. The files are written either way.

Fix: Check a listed file from the command line, in your Laramin's folder:

Bash
php -l Modules/Inventory/Http/Controllers/ProductController.php

If it prints No syntax errors detected, the file is fine and the warning came from the check itself. If it prints an error, fix the file, or generate again with Overwrite existing files on.

3. A marker wasn't found

Generating a resource adds its routes, policy and permissions to the module's existing files, at marker comments such as // [scaffold:routes]. Modules made by the Scaffolder have them. Modules written by hand usually don't, so the Scaffolder prints the lines it couldn't add.

Fix: Copy the printed block into the named file yourself. Or add the marker comments where the lines belong, then generate again with Overwrite existing files on:

PHP
// [scaffold:routes]
// [scaffold:policies]
// [scaffold:permissions]

4. Every file was skipped

The files already exist, usually from an earlier run. The Scaffolder never replaces a file unless you ask it to.

Fix: Turn on Overwrite existing files and generate again. Overwritten files lose the changes you made to them.

5. A new screen has no menu entry, or doesn't open

Generating a resource writes the files, but doesn't change your database or your menus. Work through the Next steps on the Result card, in your Laramin's folder, with your module's name in place of Inventory:

  • Opening the screen fails with an error: the table may not exist yet. Run the migration:

    Bash
    php artisan module:migrate Inventory
  • Only super admins can open the screen: the permissions weren't added or given. Run the lines below, then give the new permissions to the roles that need them. See Give someone a role.

    Bash
    php artisan permission:sync --module=Inventory --force
    php artisan optimize:clear
  • There's no menu entry: the entry is written to the module's navigation.json, but Laramin only reads that file when the module is installed, upgraded, licensed or turned on again. No command rebuilds the menu on its own. Add the entry by hand in Menu Manager: create a sidebar item with the screen's route, then place it in the sidebar. See Add or change a sidebar item.

Careful: Turning the module off and on again in Addons also adds the entry, but it resets that module's menu items in every sidebar and loses your changes to them. See A menu item is missing or keeps coming back.

6. A new module shell can't be turned on

In Stub Generator 1.1.0, a module shell made with Create module can't be turned on yet. Laramin only loads add-ons listed in Addons › Addon Management. Creating a shell writes its folder, but doesn't add it to that list, and Addons has no way to pick up a new folder. So the shell doesn't appear in Addons, and the Next steps fail at the second line:

Plain text
Module [Inventory] does not exist!

Creating the shell with php artisan laramin:make-module gives the same shell, with the same next steps.

Fix: There's no fix yet. Don't build on a shell made this way. To add screens now, use Resource mode on a module that's already listed in Addons. If you don't need the shell, delete its folder from Modules/ on your development copy.

Still not working?

Raise a ticket from Support Center in your Laramin app. Include this page's link, your Stub Generator and Laramin versions, the module and entity names, and the full text of the Result card.