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') +

Hello World

+ +

+ 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 @@ + + + + + + + Module API + + {{-- Laravel Vite - CSS File --}} + {{-- {{ module_vite('build-api', 'Resources/assets/sass/app.scss') }} --}} + + + + @yield('content') + + {{-- Laravel Vite - JS File --}} + {{-- {{ module_vite('build-api', 'Resources/assets/js/app.js') }} --}} + + diff --git a/Modules/Agents/Routes/.gitkeep b/Modules/Agents/Routes/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Routes/api.php b/Modules/Agents/Routes/api.php new file mode 100755 index 0000000..c4cc3ef --- /dev/null +++ b/Modules/Agents/Routes/api.php @@ -0,0 +1,22 @@ + ['auth:api']], function() { + Route::post('/add_customer', [AgentActionApi::class, 'addCustomer'])->name('agent_add_customer'); +}); + +// Route::get('/RP006', function(Request $request){ +// var_dump( $request->bearerToken()); +// })/*->middleware('auth:api')*/; //disable auth middleware to inspect header diff --git a/Modules/Agents/Routes/web.php b/Modules/Agents/Routes/web.php new file mode 100755 index 0000000..966a9d6 --- /dev/null +++ b/Modules/Agents/Routes/web.php @@ -0,0 +1,16 @@ +group(function() { + Route::get('/', [\Modules\Agents\Http\Controllers\AgentController::class, 'index']); +}); diff --git a/Modules/Agents/Tests/Feature/.gitkeep b/Modules/Agents/Tests/Feature/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/Tests/Unit/.gitkeep b/Modules/Agents/Tests/Unit/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/Modules/Agents/module.json b/Modules/Agents/module.json new file mode 100755 index 0000000..fac1810 --- /dev/null +++ b/Modules/Agents/module.json @@ -0,0 +1,11 @@ +{ + "name": "Agents", + "alias": "agents", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\Agents\\Providers\\AgentsServiceProvider" + ], + "files": [] +} diff --git a/Modules/Agents/package.json b/Modules/Agents/package.json new file mode 100755 index 0000000..c6f4c1f --- /dev/null +++ b/Modules/Agents/package.json @@ -0,0 +1,24 @@ +{ + "private": true, + "scripts": { + "dev": "npm run development", + "development": "mix", + "watch": "mix watch", + "watch-poll": "mix watch -- --watch-options-poll=1000", + "hot": "mix watch --hot", + "prod": "npm run production", + "production": "mix --production" + }, + "devDependencies": { + "axios": "^0.21.4", + "dotenv": "^10.0.0", + "dotenv-expand": "^5.1.0", + "laravel-mix": "^6.0.31", + "laravel-mix-merge-manifest": "^2.0.0", + "lodash": "^4.17.21", + "postcss": "^8.3.7", + "resolve-url-loader": "^5.0.0", + "sass": "^1.56.2", + "sass-loader": "^12.6.0" + } +} diff --git a/Modules/Agents/tailwind.config.js b/Modules/Agents/tailwind.config.js new file mode 100755 index 0000000..d44df10 --- /dev/null +++ b/Modules/Agents/tailwind.config.js @@ -0,0 +1,20 @@ +const defaultTheme = require('tailwindcss/defaultTheme'); + +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', + './storage/framework/views/*.php', + './resources/views/**/*.blade.php', + ], + + theme: { + extend: { + fontFamily: { + sans: ['Nunito', ...defaultTheme.fontFamily.sans], + }, + }, + }, + + plugins: [require('@tailwindcss/forms')], +}; diff --git a/Modules/Agents/webpack.mix.js b/Modules/Agents/webpack.mix.js new file mode 100755 index 0000000..a547d73 --- /dev/null +++ b/Modules/Agents/webpack.mix.js @@ -0,0 +1,14 @@ +const dotenvExpand = require('dotenv-expand'); +dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/})); + +const mix = require('laravel-mix'); +require('laravel-mix-merge-manifest'); + +mix.setPublicPath('../../public').mergeManifest(); + +mix.js(__dirname + '/Resources/assets/js/app.js', '/public/modules/api/js/api.js') + .sass( __dirname + '/Resources/assets/sass/app.scss', '/public/modules/api/css/api.css'); + +if (mix.inProduction()) { + mix.version(); +} diff --git a/modules_statuses.json b/modules_statuses.json index a223e2e..b57dd1e 100755 --- a/modules_statuses.json +++ b/modules_statuses.json @@ -3,5 +3,5 @@ "Learn": true, "Exam": true, "API": true, - "Video": true + "Agents": true } \ No newline at end of file