Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
'MODULE_NAMESPACE',
'PROVIDER_NAMESPACE',
],
'assets/scripts/module' => ['LOWER_NAME'],
'assets/scripts/stores/sample-store' => ['LOWER_NAME'],
'resources/scripts/module' => ['LOWER_NAME'],
'resources/scripts/stores/sample-store' => ['LOWER_NAME'],
'vite.config' => ['LOWER_NAME'],
],
'gitkeep' => true,
Expand Down
8 changes: 4 additions & 4 deletions src/Commands/stubs/resources/scripts/module.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import SamplePage from './views/SamplePage.vue'
import moduleLocales from '~/locales/locales'
import '../sass/module.scss'

window.Crater.booting((app, router) => {
window.Crater.addMessages(moduleLocales)
window.InvoiceShelf.booting((app, router) => {
window.InvoiceShelf.addMessages(moduleLocales)

router.addRoute({
path: '/$LOWER_NAME$/sample-page',
router.addRoute('admin', {
path: '$LOWER_NAME$',
component: SamplePage,
})

Expand Down
31 changes: 31 additions & 0 deletions src/Commands/stubs/scaffold/provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class $CLASS$ extends ServiceProvider
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->registerMenu();
$this->registerPublicFiles();
$this->loadMigrationsFrom(module_path($this->moduleName, '$MIGRATIONS_PATH$'));
}

Expand Down Expand Up @@ -109,4 +111,33 @@ class $CLASS$ extends ServiceProvider
}
return $paths;
}

public function registerMenu()
{
$data = [
'title' => '$LOWER_NAME$.$LOWER_NAME$_title',
'name' => '$MODULE$',
'link' => '/admin/$LOWER_NAME$',
'icon' => 'QuestionMarkCircleIcon',
'group' => 1,
];

\Menu::make('main_menu', function ($menu) use ($data) {
$menu->add($data['title'], $data['link'])
->data('icon', $data['icon'])
->data('name', $data['name'])
->data('group', $data['group']);
});
}

/**
* Register public files.
*
* @return void
*/
protected function registerPublicFiles()
{
ModuleFacade::script('$LOWER_NAME$', __DIR__ . '/../dist/$LOWER_NAME$.umd.js');
ModuleFacade::style('$LOWER_NAME$', __DIR__ . '/../dist/style.css');
}
}