From 7a0fa6769f2bdeaa44ba6ca01babc9b73766f505 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 22 May 2020 16:05:10 -0400 Subject: [PATCH 01/11] Update module generation #714 --- app/Contracts/Modules/ServiceProvider.php | 49 ++++++++++++++ config/modules.php | 12 +++- config/modules_statuses.json | 2 +- .../Awards/Providers/AwardServiceProvider.php | 2 +- .../Providers/ImporterServiceProvider.php | 16 ++--- .../Providers/InstallerServiceProvider.php | 4 +- .../provider.stub => app-provider.stub} | 57 ++-------------- resources/stubs/modules/composer.stub | 5 +- .../stubs/modules/{scaffold => }/config.stub | 0 resources/stubs/modules/controller-admin.stub | 43 ++++++++---- resources/stubs/modules/controller-api.stub | 4 ++ resources/stubs/modules/controller.stub | 39 ++++++++--- resources/stubs/modules/json.stub | 5 +- resources/stubs/modules/listener-test.stub | 7 +- resources/stubs/modules/provider.stub | 39 ----------- resources/stubs/modules/route-provider.stub | 66 ++++++++++++++++--- resources/stubs/modules/routes-admin.stub | 4 +- resources/stubs/modules/routes.stub | 16 +++-- 18 files changed, 219 insertions(+), 151 deletions(-) create mode 100644 app/Contracts/Modules/ServiceProvider.php rename resources/stubs/modules/{scaffold/provider.stub => app-provider.stub} (56%) rename resources/stubs/modules/{scaffold => }/config.stub (100%) delete mode 100644 resources/stubs/modules/provider.stub diff --git a/app/Contracts/Modules/ServiceProvider.php b/app/Contracts/Modules/ServiceProvider.php new file mode 100644 index 000000000..9ff82a784 --- /dev/null +++ b/app/Contracts/Modules/ServiceProvider.php @@ -0,0 +1,49 @@ +moduleSvc->addFrontendLink('Sample', '/sample', '', $logged_in=true); + * + * Or an admin link: + * + * $this->moduleSvc->addAdminLink('Sample', '/admin/sample'); + */ + public function registerLinks(): void + { + } + + /** + * Deferred providers: + * https://laravel.com/docs/7.x/providers#deferred-providers + * + * @return array + */ + public function provides(): array + { + return []; + } +} diff --git a/config/modules.php b/config/modules.php index ee070448a..40d538b1a 100644 --- a/config/modules.php +++ b/config/modules.php @@ -11,15 +11,18 @@ 'routes' => 'Http/Routes/web.php', 'routes-api' => 'Http/Routes/api.php', 'routes-admin' => 'Http/Routes/admin.php', + 'app-provider' => 'Providers/AppServiceProvider.php', 'event-service-provider' => 'Providers/EventServiceProvider.php', + 'route-provider' => 'Providers/RouteServiceProvider.php', 'views/index' => 'Resources/views/index.blade.php', 'views/index-admin' => 'Resources/views/admin/index.blade.php', 'views/frontend' => 'Resources/views/layouts/frontend.blade.php', 'views/admin' => 'Resources/views/layouts/admin.blade.php', 'listener-test' => 'Listeners/TestEventListener.php', + 'controller' => 'Http/Controllers/Frontend/IndexController.php', 'controller-api' => 'Http/Controllers/Api/ApiController.php', 'controller-admin' => 'Http/Controllers/Admin/AdminController.php', - 'scaffold/config' => 'Config/config.php', + 'config' => 'Config/config.php', 'composer' => 'composer.json', ], 'replacements' => [ @@ -27,15 +30,18 @@ 'routes' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'routes-api' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], - 'event-service-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], + 'app-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], + 'event-service-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], + 'route-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], 'listener-test' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'views/index' => ['LOWER_NAME'], 'views/index-admin' => ['LOWER_NAME', 'STUDLY_NAME'], 'views/frontend' => ['STUDLY_NAME'], 'views/admin' => ['STUDLY_NAME'], + 'controller' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], 'controller-admin' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], 'controller-api' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], - 'scaffold/config' => ['STUDLY_NAME'], + 'config' => ['STUDLY_NAME'], 'composer' => [ 'LOWER_NAME', 'STUDLY_NAME', diff --git a/config/modules_statuses.json b/config/modules_statuses.json index d7b8ddbef..8fb58b7fa 100644 --- a/config/modules_statuses.json +++ b/config/modules_statuses.json @@ -6,4 +6,4 @@ "Updater": true, "VMSAcars": true, "Vacentral": true -} +} \ No newline at end of file diff --git a/modules/Awards/Providers/AwardServiceProvider.php b/modules/Awards/Providers/AwardServiceProvider.php index 1497163e6..9fbd7c515 100644 --- a/modules/Awards/Providers/AwardServiceProvider.php +++ b/modules/Awards/Providers/AwardServiceProvider.php @@ -2,7 +2,7 @@ namespace Modules\Awards\Providers; -use Illuminate\Support\ServiceProvider; +use App\Contracts\Modules\ServiceProvider; class AwardServiceProvider extends ServiceProvider { diff --git a/modules/Importer/Providers/ImporterServiceProvider.php b/modules/Importer/Providers/ImporterServiceProvider.php index 8a36b204b..6369c455d 100644 --- a/modules/Importer/Providers/ImporterServiceProvider.php +++ b/modules/Importer/Providers/ImporterServiceProvider.php @@ -2,8 +2,8 @@ namespace Modules\Importer\Providers; +use App\Contracts\Modules\ServiceProvider; use Illuminate\Support\Facades\Route; -use Illuminate\Support\ServiceProvider; use Modules\Importer\Console\Commands\ImportFromClassicCommand; class ImporterServiceProvider extends ServiceProvider @@ -11,7 +11,7 @@ class ImporterServiceProvider extends ServiceProvider /** * Boot the application events. */ - public function boot() + public function boot(): void { $this->registerCommands(); $this->registerRoutes(); @@ -20,6 +20,9 @@ public function boot() $this->registerViews(); } + /** + * Register console commands + */ protected function registerCommands() { $this->commands([ @@ -44,7 +47,6 @@ protected function registerRoutes() // Run the actual importer process. Additional middleware Route::post('/run', 'ImporterController@run')->middleware('api')->name('run'); - Route::post('/complete', 'ImporterController@complete')->name('complete'); }); } @@ -91,12 +93,4 @@ public function registerTranslations() $this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'importer'); } } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } } diff --git a/modules/Installer/Providers/InstallerServiceProvider.php b/modules/Installer/Providers/InstallerServiceProvider.php index 06adb3f17..2154dfe92 100644 --- a/modules/Installer/Providers/InstallerServiceProvider.php +++ b/modules/Installer/Providers/InstallerServiceProvider.php @@ -2,15 +2,15 @@ namespace Modules\Installer\Providers; +use App\Contracts\Modules\ServiceProvider; use Illuminate\Support\Facades\Route; -use Illuminate\Support\ServiceProvider; class InstallerServiceProvider extends ServiceProvider { /** * Boot the application events. */ - public function boot() + public function boot(): void { $this->registerRoutes(); $this->registerTranslations(); diff --git a/resources/stubs/modules/scaffold/provider.stub b/resources/stubs/modules/app-provider.stub similarity index 56% rename from resources/stubs/modules/scaffold/provider.stub rename to resources/stubs/modules/app-provider.stub index 2f0040e1e..b22d8785b 100644 --- a/resources/stubs/modules/scaffold/provider.stub +++ b/resources/stubs/modules/app-provider.stub @@ -1,15 +1,13 @@ moduleSvc = app('App\Services\ModuleService'); - $this->registerRoutes(); $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); $this->registerLinks(); - $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); + // Uncomment this if you have migrations + // $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); } /** @@ -52,51 +50,6 @@ class $CLASS$ extends ServiceProvider $this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/admin/$LOWER_NAME$'); } - /** - * Register the routes - */ - protected function registerRoutes() - { - /** - * Routes for the frontend - */ - Route::group([ - 'as' => '$LOWER_NAME$.', - 'prefix' => '$LOWER_NAME$', - // If you want a RESTful module, change this to 'api' - 'middleware' => ['web'], - 'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers' - ], function() { - $this->loadRoutesFrom(__DIR__ . '/../Http/Routes/web.php'); - }); - - /** - * Routes for the admin - */ - Route::group([ - 'as' => '$LOWER_NAME$.', - 'prefix' => 'admin/$LOWER_NAME$', - // If you want a RESTful module, change this to 'api' - 'middleware' => ['web', 'role:admin'], - 'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Admin' - ], function() { - $this->loadRoutesFrom(__DIR__ . '/../Http/Routes/admin.php'); - }); - - /** - * Routes for an API - */ - Route::group([ - 'as' => '$LOWER_NAME$.', - 'prefix' => 'api/$LOWER_NAME$', - // If you want a RESTful module, change this to 'api' - 'middleware' => ['api'], - 'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Api' - ], function() { - $this->loadRoutesFrom(__DIR__ . '/../Http/Routes/api.php'); - }); - } - /** * Register config. */ diff --git a/resources/stubs/modules/composer.stub b/resources/stubs/modules/composer.stub index 140c27d85..91a1cd370 100644 --- a/resources/stubs/modules/composer.stub +++ b/resources/stubs/modules/composer.stub @@ -14,8 +14,9 @@ "extra": { "laravel": { "providers": [ - "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider", - "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\EventServiceProvider" + "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\AppServiceProvider", + "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\EventServiceProvider", + "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\RouteServiceProvider" ], "aliases": { diff --git a/resources/stubs/modules/scaffold/config.stub b/resources/stubs/modules/config.stub similarity index 100% rename from resources/stubs/modules/scaffold/config.stub rename to resources/stubs/modules/config.stub diff --git a/resources/stubs/modules/controller-admin.stub b/resources/stubs/modules/controller-admin.stub index 3d92c74fb..323d97f4a 100644 --- a/resources/stubs/modules/controller-admin.stub +++ b/resources/stubs/modules/controller-admin.stub @@ -6,52 +6,71 @@ use App\Contracts\Controller; use Illuminate\Http\Request; /** - * Class AdminController - * @package $MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Admin + * Admin controller */ class AdminController extends Controller { /** * Display a listing of the resource. + * + * @param Request $request + * + * @return mixed */ - public function index() + public function index(Request $request) { return view('$LOWER_NAME$::admin.index'); } /** * Show the form for creating a new resource. + * + * @param Request $request + * + * @return mixed */ - public function create() + public function create(Request $request) { return view('$LOWER_NAME$::admin.create'); } /** * Store a newly created resource in storage. + * + * @param Request $request */ public function store(Request $request) { } /** - * Show the specified resource. + * Show the form for editing the specified resource. + * + * @param Request $request + * + * @return mixed */ - public function show() + public function edit(Request $request) { - return view('$LOWER_NAME$::admin.show'); + return view('$LOWER_NAME$::admin.edit'); } /** - * Show the form for editing the specified resource. + * Show the specified resource. + * + * @param Request $request + * + * @return mixed */ - public function edit() + public function show(Request $request) { - return view('$LOWER_NAME$::admin.edit'); + return view('$LOWER_NAME$::admin.show'); } /** * Update the specified resource in storage. + * + * @param Request $request */ public function update(Request $request) { @@ -59,8 +78,10 @@ class AdminController extends Controller /** * Remove the specified resource from storage. + * + * @param Request $request */ - public function destroy() + public function destroy(Request $request) { } } diff --git a/resources/stubs/modules/controller-api.stub b/resources/stubs/modules/controller-api.stub index 3beae8878..3de5236e3 100644 --- a/resources/stubs/modules/controller-api.stub +++ b/resources/stubs/modules/controller-api.stub @@ -13,7 +13,9 @@ class ApiController extends Controller { /** * Just send out a message + * * @param Request $request + * * @return mixed */ public function index(Request $request) @@ -23,7 +25,9 @@ class ApiController extends Controller /** * Handles /hello + * * @param Request $request + * * @return mixed */ public function hello(Request $request) diff --git a/resources/stubs/modules/controller.stub b/resources/stubs/modules/controller.stub index 9c26a992d..13a559695 100644 --- a/resources/stubs/modules/controller.stub +++ b/resources/stubs/modules/controller.stub @@ -1,6 +1,6 @@ routesAreCached()) { - // require __DIR__ . '$ROUTES_PATH$'; - // } + $this->registerWebRoutes(); + $this->registerAdminRoutes(); + $this->registerApiRoutes(); + } + + /** + * + */ + protected function registerWebRoutes(): void + { + $config = [ + 'as' => '$LOWER_NAME$.', + 'prefix' => '$LOWER_NAME$', + 'namespace' => $this->namespace.'\Frontend', + 'middleware' => ['web'], + ]; + + Route::group($config, function() { + $this->loadRoutesFrom(__DIR__.'/../Http/Routes/web.php'); + }); + } + + protected function registerAdminRoutes(): void + { + $config = [ + 'as' => 'admin.$LOWER_NAME$.', + 'prefix' => 'admin/$LOWER_NAME$', + 'namespace' => $this->namespace.'\Admin', + 'middleware' => ['web', 'role:admin'], + ]; + + Route::group($config, function() { + $this->loadRoutesFrom(__DIR__.'/../Http/Routes/web.php'); + }); + } + + /** + * Register any API routes your module has. Remove this if you aren't using any + */ + protected function registerApiRoutes(): void + { + $config = [ + 'as' => 'admin.$LOWER_NAME$.', + 'prefix' => 'admin/$LOWER_NAME$', + 'namespace' => $this->namespace.'\Api', + 'middleware' => ['api'], + ]; + + Route::group($config, function() { + $this->loadRoutesFrom(__DIR__.'/../Http/Routes/api.php'); + }); } } diff --git a/resources/stubs/modules/routes-admin.stub b/resources/stubs/modules/routes-admin.stub index ad8120c70..4a49d8f64 100644 --- a/resources/stubs/modules/routes-admin.stub +++ b/resources/stubs/modules/routes-admin.stub @@ -1,6 +1,4 @@ [ - 'role:user' # leave blank to make this public -]], function() { - # all your routes are prefixed with the above prefix - # e.g. yoursite.com/sample - Route::get('/', '$STUDLY_NAME$Controller@index'); -}); +Route::get('/', '$STUDLY_NAME$Controller@index'); + +/* + * To register a route that needs to be authentication, wrap it in a + * Route::group() with the auth middleware + */ +// Route::group(['middleware' => 'auth'], function() { +// Route::get('/', '$STUDLY_NAME$Controller@index'); +// }) From e0e69c97d6f9b1976df07d4aebec70de8c6fbca7 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 22 May 2020 18:24:58 -0400 Subject: [PATCH 02/11] Fix method signatures --- resources/stubs/modules/app-provider.stub | 12 +-- resources/stubs/modules/provider.stub | 97 +++++++++++++++++++++++ 2 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 resources/stubs/modules/provider.stub diff --git a/resources/stubs/modules/app-provider.stub b/resources/stubs/modules/app-provider.stub index b22d8785b..ebb0d45b9 100644 --- a/resources/stubs/modules/app-provider.stub +++ b/resources/stubs/modules/app-provider.stub @@ -16,7 +16,7 @@ class AppServiceProvider extends ServiceProvider /** * Boot the application events. */ - public function boot() + public function boot(): void { $this->moduleSvc = app('App\Services\ModuleService'); @@ -41,7 +41,7 @@ class AppServiceProvider extends ServiceProvider /** * Add module links here */ - public function registerLinks() + public function registerLinks(): void { // Show this link if logged in // $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true); @@ -94,12 +94,4 @@ class AppServiceProvider extends ServiceProvider $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); } } - - /** - * Get the services provided by the provider. - */ - public function provides() - { - return []; - } } diff --git a/resources/stubs/modules/provider.stub b/resources/stubs/modules/provider.stub new file mode 100644 index 000000000..ebb0d45b9 --- /dev/null +++ b/resources/stubs/modules/provider.stub @@ -0,0 +1,97 @@ +moduleSvc = app('App\Services\ModuleService'); + + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + + $this->registerLinks(); + + // Uncomment this if you have migrations + // $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); + } + + /** + * Register the service provider. + */ + public function register() + { + // + } + + /** + * Add module links here + */ + public function registerLinks(): void + { + // Show this link if logged in + // $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true); + + // Admin links: + $this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/admin/$LOWER_NAME$'); + } + + /** + * Register config. + */ + protected function registerConfig() + { + $this->publishes([ + __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), + ], '$LOWER_NAME$'); + + $this->mergeConfigFrom( + __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' + ); + } + + /** + * Register views. + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/$LOWER_NAME$'); + $sourcePath = __DIR__.'/../$PATH_VIEWS$'; + + $this->publishes([ + $sourcePath => $viewPath + ],'views'); + + $this->loadViewsFrom(array_merge(array_map(function ($path) { + return $path . '/modules/$LOWER_NAME$'; + }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); + } + + /** + * Register translations. + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/$LOWER_NAME$'); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); + } else { + $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); + } + } +} From ab3adb989db348ee53e45daf45390c01dbd7a4f9 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 22 May 2020 19:08:49 -0400 Subject: [PATCH 03/11] Fix paths within stubs, use single provider.stub file --- config/modules.php | 4 +- resources/stubs/modules/app-provider.stub | 97 ----------------------- resources/stubs/modules/controller.stub | 2 +- resources/stubs/modules/provider.stub | 14 ++-- 4 files changed, 8 insertions(+), 109 deletions(-) delete mode 100644 resources/stubs/modules/app-provider.stub diff --git a/config/modules.php b/config/modules.php index 40d538b1a..6bf8ed35e 100644 --- a/config/modules.php +++ b/config/modules.php @@ -11,7 +11,7 @@ 'routes' => 'Http/Routes/web.php', 'routes-api' => 'Http/Routes/api.php', 'routes-admin' => 'Http/Routes/admin.php', - 'app-provider' => 'Providers/AppServiceProvider.php', + 'provider' => 'Providers/AppServiceProvider.php', 'event-service-provider' => 'Providers/EventServiceProvider.php', 'route-provider' => 'Providers/RouteServiceProvider.php', 'views/index' => 'Resources/views/index.blade.php', @@ -30,7 +30,7 @@ 'routes' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'routes-api' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], - 'app-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], + 'provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'event-service-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], 'route-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], 'listener-test' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], diff --git a/resources/stubs/modules/app-provider.stub b/resources/stubs/modules/app-provider.stub deleted file mode 100644 index ebb0d45b9..000000000 --- a/resources/stubs/modules/app-provider.stub +++ /dev/null @@ -1,97 +0,0 @@ -moduleSvc = app('App\Services\ModuleService'); - - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - - $this->registerLinks(); - - // Uncomment this if you have migrations - // $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); - } - - /** - * Register the service provider. - */ - public function register() - { - // - } - - /** - * Add module links here - */ - public function registerLinks(): void - { - // Show this link if logged in - // $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true); - - // Admin links: - $this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/admin/$LOWER_NAME$'); - } - - /** - * Register config. - */ - protected function registerConfig() - { - $this->publishes([ - __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), - ], '$LOWER_NAME$'); - - $this->mergeConfigFrom( - __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' - ); - } - - /** - * Register views. - */ - public function registerViews() - { - $viewPath = resource_path('views/modules/$LOWER_NAME$'); - $sourcePath = __DIR__.'/../$PATH_VIEWS$'; - - $this->publishes([ - $sourcePath => $viewPath - ],'views'); - - $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . '/modules/$LOWER_NAME$'; - }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); - } - - /** - * Register translations. - */ - public function registerTranslations() - { - $langPath = resource_path('lang/modules/$LOWER_NAME$'); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); - } else { - $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); - } - } -} diff --git a/resources/stubs/modules/controller.stub b/resources/stubs/modules/controller.stub index 13a559695..52f404caa 100644 --- a/resources/stubs/modules/controller.stub +++ b/resources/stubs/modules/controller.stub @@ -9,7 +9,7 @@ use Illuminate\Http\Request; * Class $CLASS$ * @package $CLASS_NAMESPACE$ */ -class IndexController extends Controller +class $CLASS$ extends Controller { /** * Display a listing of the resource. diff --git a/resources/stubs/modules/provider.stub b/resources/stubs/modules/provider.stub index ebb0d45b9..015f9f149 100644 --- a/resources/stubs/modules/provider.stub +++ b/resources/stubs/modules/provider.stub @@ -56,12 +56,10 @@ class AppServiceProvider extends ServiceProvider protected function registerConfig() { $this->publishes([ - __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), + __DIR__.'/../Config/config.php' => config_path('$LOWER_NAME$.php'), ], '$LOWER_NAME$'); - $this->mergeConfigFrom( - __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' - ); + $this->mergeConfigFrom(__DIR__.'/../Config/config.php', '$LOWER_NAME$'); } /** @@ -70,11 +68,9 @@ class AppServiceProvider extends ServiceProvider public function registerViews() { $viewPath = resource_path('views/modules/$LOWER_NAME$'); - $sourcePath = __DIR__.'/../$PATH_VIEWS$'; + $sourcePath = __DIR__.'/../Resources/views'; - $this->publishes([ - $sourcePath => $viewPath - ],'views'); + $this->publishes([$sourcePath => $viewPath],'views'); $this->loadViewsFrom(array_merge(array_map(function ($path) { return $path . '/modules/$LOWER_NAME$'; @@ -91,7 +87,7 @@ class AppServiceProvider extends ServiceProvider if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); } else { - $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); + $this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', '$LOWER_NAME$'); } } } From 715c74edce882f187b515c0bf79ac10b3a7e97a3 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 22 May 2020 19:13:23 -0400 Subject: [PATCH 04/11] Add separate index controller --- config/modules.php | 2 +- resources/stubs/modules/controller-index.stub | 90 +++++++++++++++++++ 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 resources/stubs/modules/controller-index.stub diff --git a/config/modules.php b/config/modules.php index 6bf8ed35e..9c8da9998 100644 --- a/config/modules.php +++ b/config/modules.php @@ -19,7 +19,7 @@ 'views/frontend' => 'Resources/views/layouts/frontend.blade.php', 'views/admin' => 'Resources/views/layouts/admin.blade.php', 'listener-test' => 'Listeners/TestEventListener.php', - 'controller' => 'Http/Controllers/Frontend/IndexController.php', + 'controller-index' => 'Http/Controllers/Frontend/IndexController.php', 'controller-api' => 'Http/Controllers/Api/ApiController.php', 'controller-admin' => 'Http/Controllers/Admin/AdminController.php', 'config' => 'Config/config.php', diff --git a/resources/stubs/modules/controller-index.stub b/resources/stubs/modules/controller-index.stub new file mode 100644 index 000000000..13a559695 --- /dev/null +++ b/resources/stubs/modules/controller-index.stub @@ -0,0 +1,90 @@ + Date: Fri, 22 May 2020 16:05:10 -0400 Subject: [PATCH 05/11] Update module generation #714 --- resources/stubs/modules/app-provider.stub | 0 resources/stubs/modules/controller.stub | 2 +- resources/stubs/modules/provider.stub | 93 ----------------------- 3 files changed, 1 insertion(+), 94 deletions(-) create mode 100644 resources/stubs/modules/app-provider.stub delete mode 100644 resources/stubs/modules/provider.stub diff --git a/resources/stubs/modules/app-provider.stub b/resources/stubs/modules/app-provider.stub new file mode 100644 index 000000000..e69de29bb diff --git a/resources/stubs/modules/controller.stub b/resources/stubs/modules/controller.stub index 52f404caa..13a559695 100644 --- a/resources/stubs/modules/controller.stub +++ b/resources/stubs/modules/controller.stub @@ -9,7 +9,7 @@ use Illuminate\Http\Request; * Class $CLASS$ * @package $CLASS_NAMESPACE$ */ -class $CLASS$ extends Controller +class IndexController extends Controller { /** * Display a listing of the resource. diff --git a/resources/stubs/modules/provider.stub b/resources/stubs/modules/provider.stub deleted file mode 100644 index 015f9f149..000000000 --- a/resources/stubs/modules/provider.stub +++ /dev/null @@ -1,93 +0,0 @@ -moduleSvc = app('App\Services\ModuleService'); - - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - - $this->registerLinks(); - - // Uncomment this if you have migrations - // $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); - } - - /** - * Register the service provider. - */ - public function register() - { - // - } - - /** - * Add module links here - */ - public function registerLinks(): void - { - // Show this link if logged in - // $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true); - - // Admin links: - $this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/admin/$LOWER_NAME$'); - } - - /** - * Register config. - */ - protected function registerConfig() - { - $this->publishes([ - __DIR__.'/../Config/config.php' => config_path('$LOWER_NAME$.php'), - ], '$LOWER_NAME$'); - - $this->mergeConfigFrom(__DIR__.'/../Config/config.php', '$LOWER_NAME$'); - } - - /** - * Register views. - */ - public function registerViews() - { - $viewPath = resource_path('views/modules/$LOWER_NAME$'); - $sourcePath = __DIR__.'/../Resources/views'; - - $this->publishes([$sourcePath => $viewPath],'views'); - - $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . '/modules/$LOWER_NAME$'; - }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); - } - - /** - * Register translations. - */ - public function registerTranslations() - { - $langPath = resource_path('lang/modules/$LOWER_NAME$'); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); - } else { - $this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', '$LOWER_NAME$'); - } - } -} From 8985a6c49a02f8626184acb32157970cbd71e120 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 22 May 2020 18:24:58 -0400 Subject: [PATCH 06/11] Fix method signatures --- resources/stubs/modules/app-provider.stub | 97 +++++++++++++++++++++++ resources/stubs/modules/provider.stub | 97 +++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 resources/stubs/modules/provider.stub diff --git a/resources/stubs/modules/app-provider.stub b/resources/stubs/modules/app-provider.stub index e69de29bb..ebb0d45b9 100644 --- a/resources/stubs/modules/app-provider.stub +++ b/resources/stubs/modules/app-provider.stub @@ -0,0 +1,97 @@ +moduleSvc = app('App\Services\ModuleService'); + + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + + $this->registerLinks(); + + // Uncomment this if you have migrations + // $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); + } + + /** + * Register the service provider. + */ + public function register() + { + // + } + + /** + * Add module links here + */ + public function registerLinks(): void + { + // Show this link if logged in + // $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true); + + // Admin links: + $this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/admin/$LOWER_NAME$'); + } + + /** + * Register config. + */ + protected function registerConfig() + { + $this->publishes([ + __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), + ], '$LOWER_NAME$'); + + $this->mergeConfigFrom( + __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' + ); + } + + /** + * Register views. + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/$LOWER_NAME$'); + $sourcePath = __DIR__.'/../$PATH_VIEWS$'; + + $this->publishes([ + $sourcePath => $viewPath + ],'views'); + + $this->loadViewsFrom(array_merge(array_map(function ($path) { + return $path . '/modules/$LOWER_NAME$'; + }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); + } + + /** + * Register translations. + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/$LOWER_NAME$'); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); + } else { + $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); + } + } +} diff --git a/resources/stubs/modules/provider.stub b/resources/stubs/modules/provider.stub new file mode 100644 index 000000000..ebb0d45b9 --- /dev/null +++ b/resources/stubs/modules/provider.stub @@ -0,0 +1,97 @@ +moduleSvc = app('App\Services\ModuleService'); + + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + + $this->registerLinks(); + + // Uncomment this if you have migrations + // $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); + } + + /** + * Register the service provider. + */ + public function register() + { + // + } + + /** + * Add module links here + */ + public function registerLinks(): void + { + // Show this link if logged in + // $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true); + + // Admin links: + $this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/admin/$LOWER_NAME$'); + } + + /** + * Register config. + */ + protected function registerConfig() + { + $this->publishes([ + __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), + ], '$LOWER_NAME$'); + + $this->mergeConfigFrom( + __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' + ); + } + + /** + * Register views. + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/$LOWER_NAME$'); + $sourcePath = __DIR__.'/../$PATH_VIEWS$'; + + $this->publishes([ + $sourcePath => $viewPath + ],'views'); + + $this->loadViewsFrom(array_merge(array_map(function ($path) { + return $path . '/modules/$LOWER_NAME$'; + }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); + } + + /** + * Register translations. + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/$LOWER_NAME$'); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); + } else { + $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); + } + } +} From cad39da67710f6dd11cbdd252e036ba945137f03 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 22 May 2020 19:08:49 -0400 Subject: [PATCH 07/11] Fix paths within stubs, use single provider.stub file --- resources/stubs/modules/app-provider.stub | 97 ----------------------- resources/stubs/modules/controller.stub | 2 +- resources/stubs/modules/provider.stub | 14 ++-- 3 files changed, 6 insertions(+), 107 deletions(-) delete mode 100644 resources/stubs/modules/app-provider.stub diff --git a/resources/stubs/modules/app-provider.stub b/resources/stubs/modules/app-provider.stub deleted file mode 100644 index ebb0d45b9..000000000 --- a/resources/stubs/modules/app-provider.stub +++ /dev/null @@ -1,97 +0,0 @@ -moduleSvc = app('App\Services\ModuleService'); - - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - - $this->registerLinks(); - - // Uncomment this if you have migrations - // $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); - } - - /** - * Register the service provider. - */ - public function register() - { - // - } - - /** - * Add module links here - */ - public function registerLinks(): void - { - // Show this link if logged in - // $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true); - - // Admin links: - $this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/admin/$LOWER_NAME$'); - } - - /** - * Register config. - */ - protected function registerConfig() - { - $this->publishes([ - __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), - ], '$LOWER_NAME$'); - - $this->mergeConfigFrom( - __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' - ); - } - - /** - * Register views. - */ - public function registerViews() - { - $viewPath = resource_path('views/modules/$LOWER_NAME$'); - $sourcePath = __DIR__.'/../$PATH_VIEWS$'; - - $this->publishes([ - $sourcePath => $viewPath - ],'views'); - - $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . '/modules/$LOWER_NAME$'; - }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); - } - - /** - * Register translations. - */ - public function registerTranslations() - { - $langPath = resource_path('lang/modules/$LOWER_NAME$'); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); - } else { - $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); - } - } -} diff --git a/resources/stubs/modules/controller.stub b/resources/stubs/modules/controller.stub index 13a559695..52f404caa 100644 --- a/resources/stubs/modules/controller.stub +++ b/resources/stubs/modules/controller.stub @@ -9,7 +9,7 @@ use Illuminate\Http\Request; * Class $CLASS$ * @package $CLASS_NAMESPACE$ */ -class IndexController extends Controller +class $CLASS$ extends Controller { /** * Display a listing of the resource. diff --git a/resources/stubs/modules/provider.stub b/resources/stubs/modules/provider.stub index ebb0d45b9..015f9f149 100644 --- a/resources/stubs/modules/provider.stub +++ b/resources/stubs/modules/provider.stub @@ -56,12 +56,10 @@ class AppServiceProvider extends ServiceProvider protected function registerConfig() { $this->publishes([ - __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), + __DIR__.'/../Config/config.php' => config_path('$LOWER_NAME$.php'), ], '$LOWER_NAME$'); - $this->mergeConfigFrom( - __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' - ); + $this->mergeConfigFrom(__DIR__.'/../Config/config.php', '$LOWER_NAME$'); } /** @@ -70,11 +68,9 @@ class AppServiceProvider extends ServiceProvider public function registerViews() { $viewPath = resource_path('views/modules/$LOWER_NAME$'); - $sourcePath = __DIR__.'/../$PATH_VIEWS$'; + $sourcePath = __DIR__.'/../Resources/views'; - $this->publishes([ - $sourcePath => $viewPath - ],'views'); + $this->publishes([$sourcePath => $viewPath],'views'); $this->loadViewsFrom(array_merge(array_map(function ($path) { return $path . '/modules/$LOWER_NAME$'; @@ -91,7 +87,7 @@ class AppServiceProvider extends ServiceProvider if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); } else { - $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); + $this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', '$LOWER_NAME$'); } } } From 028601fff40fbaef1fb82b091106facca092625f Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 8 Aug 2020 10:36:41 -0400 Subject: [PATCH 08/11] Update module generation Disable/lower the cache time as found as a workaround in https://github.com/nWidart/laravel-modules/issues/995 --- config/modules.php | 16 +++++++++------- config/modules_statuses.json | 3 ++- resources/stubs/modules/route-provider.stub | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/config/modules.php b/config/modules.php index 9c8da9998..3155f54db 100644 --- a/config/modules.php +++ b/config/modules.php @@ -11,9 +11,9 @@ 'routes' => 'Http/Routes/web.php', 'routes-api' => 'Http/Routes/api.php', 'routes-admin' => 'Http/Routes/admin.php', - 'provider' => 'Providers/AppServiceProvider.php', + // 'provider' => 'Providers/AppServiceProvider.php', 'event-service-provider' => 'Providers/EventServiceProvider.php', - 'route-provider' => 'Providers/RouteServiceProvider.php', + // 'route-provider' => 'Providers/RouteServiceProvider.php', 'views/index' => 'Resources/views/index.blade.php', 'views/index-admin' => 'Resources/views/admin/index.blade.php', 'views/frontend' => 'Resources/views/layouts/frontend.blade.php', @@ -32,13 +32,13 @@ 'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'event-service-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], - 'route-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], + // 'route-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], 'listener-test' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'views/index' => ['LOWER_NAME'], 'views/index-admin' => ['LOWER_NAME', 'STUDLY_NAME'], 'views/frontend' => ['STUDLY_NAME'], 'views/admin' => ['STUDLY_NAME'], - 'controller' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], + 'controller-index' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], 'controller-admin' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], 'controller-api' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], 'config' => ['STUDLY_NAME'], @@ -49,6 +49,7 @@ 'AUTHOR_NAME', 'AUTHOR_EMAIL', 'MODULE_NAMESPACE', + 'PROVIDER_NAMESPACE', ], ], 'gitkeep' => false, @@ -64,9 +65,10 @@ 'seeds' => ['path' => 'Database/seeds', 'generate' => true], 'factory' => ['path' => 'Database/factories', 'generate' => true], 'model' => ['path' => 'Models', 'generate' => true], - 'controller' => ['path' => 'Http/Controllers', 'generate' => true], + //'controller' => ['path' => 'Http/Controllers', 'generate' => true], 'controller-admin' => ['path' => 'Http/Controllers/Admin', 'generate' => true], 'controller-api' => ['path' => 'Http/Controllers/Api', 'generate' => true], + 'controller-index' => ['path' => 'Http/Controllers/Frontend', 'generate' => true], 'filter' => ['path' => 'Http/Middleware', 'generate' => true], 'request' => ['path' => 'Http/Requests', 'generate' => true], 'routes' => ['path' => 'Http/Routes', 'generate' => true], @@ -130,7 +132,7 @@ 'cache' => [ 'enabled' => true, 'key' => 'phpvms-modules', - 'lifetime' => 10, + 'lifetime' => 0, ], /* |-------------------------------------------------------------------------- @@ -149,7 +151,7 @@ 'class' => FileActivator::class, 'statuses-file' => config_path('modules_statuses.json'), 'cache-key' => 'activator.installed', - 'cache-lifetime' => 604800, + 'cache-lifetime' => 0, ], ], ]; diff --git a/config/modules_statuses.json b/config/modules_statuses.json index 8fb58b7fa..f5ddf9953 100644 --- a/config/modules_statuses.json +++ b/config/modules_statuses.json @@ -5,5 +5,6 @@ "Sample": true, "Updater": true, "VMSAcars": true, - "Vacentral": true + "Vacentral": true, + "TestModule": true } \ No newline at end of file diff --git a/resources/stubs/modules/route-provider.stub b/resources/stubs/modules/route-provider.stub index 102de1427..13307df06 100644 --- a/resources/stubs/modules/route-provider.stub +++ b/resources/stubs/modules/route-provider.stub @@ -1,6 +1,6 @@ Date: Sat, 8 Aug 2020 10:42:38 -0400 Subject: [PATCH 09/11] Update editorconfig for line endings --- .editorconfig | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.editorconfig b/.editorconfig index b8183e82a..7810fa9c2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,20 +1,22 @@ # root = true -[*.js] +[*] indent_style = space +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.js] indent_size = 2 [*.php] -indent_style = space indent_size = 4 [*.blade.php] -indent_style = space indent_size = 2 [*.stub] -indent_style = space indent_size = 4 [Makefile] @@ -22,5 +24,4 @@ indent_style = tab # Matches the exact files either package.json or .travis.yml [{package.json, .travis.yml}] -indent_style = space indent_size = 2 From 973c61ed15372d4680f4bc763c7a6f3846d0606f Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 8 Aug 2020 10:50:22 -0400 Subject: [PATCH 10/11] Formatting --- config/modules.php | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/config/modules.php b/config/modules.php index 3155f54db..71386daa3 100644 --- a/config/modules.php +++ b/config/modules.php @@ -11,9 +11,7 @@ 'routes' => 'Http/Routes/web.php', 'routes-api' => 'Http/Routes/api.php', 'routes-admin' => 'Http/Routes/admin.php', - // 'provider' => 'Providers/AppServiceProvider.php', 'event-service-provider' => 'Providers/EventServiceProvider.php', - // 'route-provider' => 'Providers/RouteServiceProvider.php', 'views/index' => 'Resources/views/index.blade.php', 'views/index-admin' => 'Resources/views/admin/index.blade.php', 'views/frontend' => 'Resources/views/layouts/frontend.blade.php', @@ -31,16 +29,35 @@ 'routes-api' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], - 'event-service-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], - // 'route-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'CLASS_NAMESPACE'], + 'event-service-provider' => [ + 'LOWER_NAME', + 'STUDLY_NAME', + 'MODULE_NAMESPACE', + 'CLASS_NAMESPACE', + ], 'listener-test' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], 'views/index' => ['LOWER_NAME'], 'views/index-admin' => ['LOWER_NAME', 'STUDLY_NAME'], 'views/frontend' => ['STUDLY_NAME'], 'views/admin' => ['STUDLY_NAME'], - 'controller-index' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], - 'controller-admin' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], - 'controller-api' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'], + 'controller-index' => [ + 'MODULE_NAMESPACE', + 'STUDLY_NAME', + 'CLASS_NAMESPACE', + 'LOWER_NAME', + ], + 'controller-admin' => [ + 'MODULE_NAMESPACE', + 'STUDLY_NAME', + 'CLASS_NAMESPACE', + 'LOWER_NAME', + ], + 'controller-api' => [ + 'MODULE_NAMESPACE', + 'STUDLY_NAME', + 'CLASS_NAMESPACE', + 'LOWER_NAME', + ], 'config' => ['STUDLY_NAME'], 'composer' => [ 'LOWER_NAME', @@ -59,12 +76,12 @@ 'assets' => public_path('modules'), 'migration' => base_path('database/migrations'), 'generator' => [ - 'config' => ['path' => 'Config', 'generate' => true], - 'command' => ['path' => 'Console', 'generate' => true], - 'migration' => ['path' => 'Database/migrations', 'generate' => true], - 'seeds' => ['path' => 'Database/seeds', 'generate' => true], - 'factory' => ['path' => 'Database/factories', 'generate' => true], - 'model' => ['path' => 'Models', 'generate' => true], + 'config' => ['path' => 'Config', 'generate' => true], + 'command' => ['path' => 'Console', 'generate' => true], + 'migration' => ['path' => 'Database/migrations', 'generate' => true], + 'seeds' => ['path' => 'Database/seeds', 'generate' => true], + 'factory' => ['path' => 'Database/factories', 'generate' => true], + 'model' => ['path' => 'Models', 'generate' => true], //'controller' => ['path' => 'Http/Controllers', 'generate' => true], 'controller-admin' => ['path' => 'Http/Controllers/Admin', 'generate' => true], 'controller-api' => ['path' => 'Http/Controllers/Api', 'generate' => true], From 1d3f020e1f2e23155919a5cb5db118c93d7558d4 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 8 Aug 2020 10:53:09 -0400 Subject: [PATCH 11/11] Formatting --- config/modules.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/modules.php b/config/modules.php index 71386daa3..b724fda29 100644 --- a/config/modules.php +++ b/config/modules.php @@ -35,31 +35,31 @@ 'MODULE_NAMESPACE', 'CLASS_NAMESPACE', ], - 'listener-test' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], - 'views/index' => ['LOWER_NAME'], - 'views/index-admin' => ['LOWER_NAME', 'STUDLY_NAME'], - 'views/frontend' => ['STUDLY_NAME'], - 'views/admin' => ['STUDLY_NAME'], - 'controller-index' => [ + 'listener-test' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], + 'views/index' => ['LOWER_NAME'], + 'views/index-admin' => ['LOWER_NAME', 'STUDLY_NAME'], + 'views/frontend' => ['STUDLY_NAME'], + 'views/admin' => ['STUDLY_NAME'], + 'controller-index' => [ 'MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME', ], - 'controller-admin' => [ + 'controller-admin' => [ 'MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME', ], - 'controller-api' => [ + 'controller-api' => [ 'MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME', ], - 'config' => ['STUDLY_NAME'], - 'composer' => [ + 'config' => ['STUDLY_NAME'], + 'composer' => [ 'LOWER_NAME', 'STUDLY_NAME', 'VENDOR',