v0.6.0 - reaching the directories a module doesn't own
Reaching the directories a module doesn't own
A module's own views are resources/views/modsx-blog/, but its layout is one slice of the application's layouts/ — the framework's directory first, the module second, exactly as in resources/css/modsx-blog/. Neither command could express that: both write the module at the front of a name.
The workaround was typing modsx-blog by hand — into make:view layouts.modsx-blog.app, or into mkdir — which is the mistake these commands exist to prevent.
modsx:make layout, page, partial
php artisan modsx:make layout blog.app # -> views/layouts/modsx-blog/app.blade.php
php artisan modsx:make page blog.index # -> views/pages/modsx-blog/index.blade.php
php artisan modsx:make partial blog.head # -> views/partials/modsx-blog/head.blade.phpThere is no make:layout in Laravel. These are entries in the same modsx.generators table, and what makes them different is that the entry names the generator to run as well as the form:
'layout' => ['view', 'layouts/{kebab}/'],
'page' => ['view', 'pages/{kebab}/'],
'partial' => ['view', 'partials/{kebab}/'],So the names are yours. 'service' => ['class', 'Services/{Studly}/'] gives you modsx:make service Blog/PostPublisher, and it appears in the interactive picker alongside Laravel's own generators.
Deliberately no component: make:component is Laravel's own and already lands correctly, writing the class and letting Laravel derive views/components/modsx-blog/ from where that class went.
modsx:scaffold takes the directories to create
Naming them makes those instead of the configured list — for the one you want now, without changing what every future module gets:
php artisan modsx:scaffold Blog resources/css
# resources/css/modsx-blog/
php artisan modsx:scaffold Blog resources/js app/Services
# resources/js/modsx-blog/
# app/Services/ModsxBlog/Note the last one: ModsxBlog, not modsx-blog. You write the path as it looks in the project, and the form of the module's own directory is read off where that path leads:
| You type | It creates |
|---|---|
resources/css, public/vendor, lang/en |
…/modsx-blog |
app/Services, database/factories, tests/Feature |
…/ModsxBlog |
app/, database/ and tests/ are the PSR-4 roots of a stock Laravel application, where a hyphen is not a legal PHP identifier. Everywhere else the name is only ever a path. Where that guess is wrong — a PSR-4 root of your own — a placeholder settles it: modsx:scaffold Blog "modules/Shared/{Studly}".
An existing directory is skipped and reported, as with the configured list, and a path may not contain ...
Also
- A path typed on the command line was refused with a message about a
modsx.scaffoldentry the reader never touched. It has its own message now. - The convention table listed
app/anddatabase/as the namespace roots while omittingtests/.
Full detail in the CHANGELOG.