Developer Commands Overview
This page documents core WNCMS developer scaffolding commands.
wncms:create-model
Create a model scaffold in the host project (model, migration, backend controller, starter views, and permissions).
php artisan wncms:create-model NovelBehavior summary:
- Generates
app/Models/Novel.phpwhen missing. - Generated model extends
Wncms\Models\BaseModeland includes amodelKeyfallback (auto-derived from class name when left empty). - Generates a migration for
novelstable. - Generates
app/Http/Controllers/Backend/NovelController.php. - Generated backend controller methods follow
BackendControllercompatible signatures (create($id),edit($id),update(Request, $id),destroy($id)). - Runs
wncms:create-model-view novel. - Runs
wncms:create-model-permission novel. - Optionally appends routes into
routes/custom_backend.php.
wncms:create-model-view
Create backend blade files for a model from starter templates.
php artisan wncms:create-model-view novelGenerated files:
resources/views/backend/novels/index.blade.phpresources/views/backend/novels/create.blade.phpresources/views/backend/novels/edit.blade.phpresources/views/backend/novels/form-items.blade.php
Starter template resolution order:
resources/views/backend/startersfrom package root../resources/views/backend/startersfrom package root- internal fallback:
src/../../resources/views/backend/starters
If no valid starter path is found, the command exits with failure and prints every checked path.
wncms:create-model-permission
Create common backend permissions for a model key.
php artisan wncms:create-model-permission novelTypical permission suffixes include:
_index_create_clone_edit_delete_bulk_delete
wncms:activate-plugin
Activate a plugin from CLI the same way as backend activation (status => active).
php artisan wncms:activate-plugin wncms-users-hook-testBehavior summary:
- Accepts plugin
name,plugin_id, or folderpath. - Scans
public/pluginsand auto-syncs missing directory plugins intopluginstable. - Runs plugin lifecycle
activate()when standardized plugin class exists. - Activates the matched plugin by setting
statustoactive. - Returns failure when
pluginstable is missing or no plugin can be matched.
wncms:verify-plugin-hooks
Run release-gate checks for plugin manifests and users hook hard-cut migration.
php artisan wncms:verify-plugin-hooksBehavior summary:
- Verifies plugin root directory (
public/plugins) exists. - Verifies every plugin directory has valid
plugin.json(id,name,version). - Verifies legacy users hook names are removed from core user controllers.
- Verifies
pluginstable exists and has no[MANIFEST_ERROR]/[LOAD_ERROR]records. - Returns failure when any gate fails (release should be blocked).
wncms:hook-list
Inspect the hook/extension registry for plugin development.
php artisan wncms:hook-listCommon usage:
# Include listener details for each hook
php artisan wncms:hook-list --listeners
# Show only hooks that currently have listeners
php artisan wncms:hook-list --only-listened
# Export as JSON for automation
php artisan wncms:hook-list --jsonBehavior summary:
- Scans WNCMS core
src(and host appapp) for dispatched hook names (Event::dispatch(...)/event(...)). - Lists each hook with dispatch-point count and current runtime listener count.
- Optional
--listenersmode prints listener identities per hook. - Includes extension registry data from
macroable-models(registered query macros by model).
Expected output format (abridged):
WNCMS Hook / Extension Registry
Hooks: 40, Macros: 2
+---------------------------------------------+-----------------+-----------+
| Hook | Dispatch Points | Listeners |
+---------------------------------------------+-----------------+-----------+
| wncms.frontend.users.login.before | 1 | 0 |
| wncms.frontend.users.register.after | 1 | 1 |
+---------------------------------------------+-----------------+-----------+
Registered Macros (Extension Registry)
+----------------+------------------------+-------------+
| Macro | Models | Model Count |
+----------------+------------------------+-------------+
| wherePublished | Wncms\Models\Post | 1 |
+----------------+------------------------+-------------+wncms:install-default-theme
Install or reinstall core default theme assets into public/themes.
php artisan wncms:install-default-theme --forceBehavior summary:
- Publishes assets from the
wncms-default-assetspublish tag. - Intended for recovery when default theme assets are edited, missing, or corrupted.
- This command is also used by installer flows (CLI and browser wizard) via shared installer logic.
wncms:update
Run core update scripts.
# Normal update flow (remote version list + incremental apply)
php artisan wncms:update core
# Rerun one specific local update file
php artisan wncms:update --version=6.1.6
php artisan wncms:update --version=v6.1.6Behavior summary:
--version=runs exactly one local update script again:updates/update_core_{version}.php
vprefix is accepted (for examplev6.1.6and6.1.6behave the same).- If
--versionis missing or not found inupdates/, command returns failure.
Installation Modes (wncms:install + Browser Wizard)
WNCMS supports two installation entry points:
- CLI command:
php artisan wncms:install ... - Browser wizard:
/install/wizard
Both modes now use the same shared installer pipeline in InstallerManager, so behavior is aligned across:
- DB connection check
.envwrite- app key generation
- database setup
- asset publishing (
wncms-core-assets,wncms-stubs,wncms-default-assets) - custom language/route file bootstrap
- system settings initialization
- install marker + cache finalize
Multi-site default behavior
multi_websitedefault isfalse.- CLI: multi-site is enabled only when passing
--multi_website. - Wizard: multi-site is enabled only when the checkbox is checked.
After installation you can verify:
php artisan tinkergss('multi_website');Troubleshooting
Source view file not found: Check that starter blades exist under packageresources/views/backend/starters.- Command created no views: Confirm target files do not already exist in
resources/views/backend/{plural}/. - Route permission denied: Re-run
wncms:create-model-permission {model}and verify role assignment in backend. - Link backend route permission denied on upgraded projects: Update to core
6.1.9+and runphp artisan wncms:update coreso Link permissions are backfilled during update.