diff --git a/config/config.php b/config/config.php index 18d96d1..c925d64 100644 --- a/config/config.php +++ b/config/config.php @@ -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, diff --git a/src/Commands/stubs/resources/scripts/module.stub b/src/Commands/stubs/resources/scripts/module.stub index f396161..355360c 100644 --- a/src/Commands/stubs/resources/scripts/module.stub +++ b/src/Commands/stubs/resources/scripts/module.stub @@ -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, }) diff --git a/src/Commands/stubs/scaffold/provider.stub b/src/Commands/stubs/scaffold/provider.stub index 4a4f053..416ae9e 100644 --- a/src/Commands/stubs/scaffold/provider.stub +++ b/src/Commands/stubs/scaffold/provider.stub @@ -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$')); } @@ -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'); + } }