diff --git a/Modules/Agents/Config/.gitkeep b/Modules/Agents/Config/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Config/config.php b/Modules/Agents/Config/config.php new file mode 100755 index 0000000..aea661b --- /dev/null +++ b/Modules/Agents/Config/config.php @@ -0,0 +1,5 @@ + 'Agents' +]; diff --git a/Modules/Agents/Console/.gitkeep b/Modules/Agents/Console/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Database/Migrations/.gitkeep b/Modules/Agents/Database/Migrations/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Database/Seeders/.gitkeep b/Modules/Agents/Database/Seeders/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Database/Seeders/AgentsDatabaseSeeder.php b/Modules/Agents/Database/Seeders/AgentsDatabaseSeeder.php new file mode 100755 index 0000000..495483c --- /dev/null +++ b/Modules/Agents/Database/Seeders/AgentsDatabaseSeeder.php @@ -0,0 +1,21 @@ +call("OthersTableSeeder"); + } +} diff --git a/Modules/Agents/Database/factories/.gitkeep b/Modules/Agents/Database/factories/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Entities/.gitkeep b/Modules/Agents/Entities/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Http/Controllers/.gitkeep b/Modules/Agents/Http/Controllers/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Http/Controllers/AgentActionApi.php b/Modules/Agents/Http/Controllers/AgentActionApi.php new file mode 100755 index 0000000..c1987ab --- /dev/null +++ b/Modules/Agents/Http/Controllers/AgentActionApi.php @@ -0,0 +1,16 @@ +registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations')); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register config. + * + * @return void + */ + protected function registerConfig() + { + $this->publishes([ + module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'), + ], 'config'); + $this->mergeConfigFrom( + module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower + ); + } + + /** + * Register views. + * + * @return void + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/' . $this->moduleNameLower); + + $sourcePath = module_path($this->moduleName, 'Resources/views'); + + $this->publishes([ + $sourcePath => $viewPath + ], ['views', $this->moduleNameLower . '-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + } + + /** + * Register translations. + * + * @return void + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/' . $this->moduleNameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadJsonTranslationsFrom($langPath, $this->moduleNameLower); + } else { + $this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower); + $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower); + } + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (\Config::get('view.paths') as $path) { + if (is_dir($path . '/modules/' . $this->moduleNameLower)) { + $paths[] = $path . '/modules/' . $this->moduleNameLower; + } + } + return $paths; + } +} diff --git a/Modules/Agents/Providers/RouteServiceProvider.php b/Modules/Agents/Providers/RouteServiceProvider.php new file mode 100755 index 0000000..004543a --- /dev/null +++ b/Modules/Agents/Providers/RouteServiceProvider.php @@ -0,0 +1,69 @@ +mapApiRoutes(); + + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + * + * @return void + */ + protected function mapWebRoutes() + { + Route::middleware('web') + ->namespace($this->moduleNamespace) + ->group(module_path('Agents', '/Routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + * + * @return void + */ + protected function mapApiRoutes() + { + Route::prefix('api') + ->middleware('api') + ->namespace($this->moduleNamespace) + ->group(module_path('Agents', '/Routes/api.php')); + } +} diff --git a/Modules/Agents/Resources/assets/.gitkeep b/Modules/Agents/Resources/assets/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Resources/assets/js/app.js b/Modules/Agents/Resources/assets/js/app.js new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Resources/assets/sass/app.scss b/Modules/Agents/Resources/assets/sass/app.scss new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Resources/lang/.gitkeep b/Modules/Agents/Resources/lang/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Resources/views/.gitkeep b/Modules/Agents/Resources/views/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Resources/views/index.blade.php b/Modules/Agents/Resources/views/index.blade.php new file mode 100755 index 0000000..e356daa --- /dev/null +++ b/Modules/Agents/Resources/views/index.blade.php @@ -0,0 +1,9 @@ +@extends('api::layouts.master') + +@section('content') +
+ This view is loaded from module: {!! config('api.name') !!} +
+@endsection diff --git a/Modules/Agents/Resources/views/layouts/master.blade.php b/Modules/Agents/Resources/views/layouts/master.blade.php new file mode 100755 index 0000000..3699f2f --- /dev/null +++ b/Modules/Agents/Resources/views/layouts/master.blade.php @@ -0,0 +1,19 @@ + + + + + + +