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 see | Go to |
|---|---|
| You can't find Scaffolder, or there's no Generate button | 1 |
| Generated with warnings — review the result below., with Syntax errors in generated files | 2 |
| 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 open | 5 |
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.). Without Generate Scaffold (feature.), 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:
Couldn't copy. Select the code and press Ctrl+C (⌘+C on a Mac).
php -l Modules/Inventory/Http/Controllers/ProductController.phpIf 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:
Couldn't copy. Select the code and press Ctrl+C (⌘+C on a Mac).
// [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:
BashCouldn't copy. Select the code and press Ctrl+C (⌘+C on a Mac).
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.
BashCouldn't copy. Select the code and press Ctrl+C (⌘+C on a Mac).
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:
Couldn't copy. Select the code and press Ctrl+C (⌘+C on a Mac).
Module [Inventory] does not exist!Creating the shell with php artisan laramin:make- 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.
Thanks. That helps us decide what to write next.
Thanks for telling us what was missing.
You already answered for this article today. Thanks.
We got a lot of answers from your network just now. Try again in a few minutes.
We couldn't send that. Check your connection and try again.
Links in this article
Printed from help.bsscn.com. The online article may have changed since.