diff --git a/composer.json b/composer.json index 2d5a306..36d278f 100755 --- a/composer.json +++ b/composer.json @@ -5,11 +5,26 @@ "description": "The skeleton application for the Laravel framework.", "keywords": ["laravel", "framework"], "license": "MIT", + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:MPBA-Ltd/laravel_modules.git" + }, + { + "type": "vcs", + "url": "git@github.com:MPBA-Ltd/laravel_settings.git" + }, + { + "type": "vcs", + "url": "git@github.com:MPBA-Ltd/laravel-charts.git" + } + ], "require": { "php": "^8.3", "deployer/deployer": "^8.0", "laravel/framework": "^13.17", "laravel/tinker": "^3.0", + "mpba/laravel-modules": "dev-main", "predis/predis": "^3.6" }, "require-dev": { @@ -25,7 +40,8 @@ "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", - "Database\\Seeders\\": "database/seeders/" + "Database\\Seeders\\": "database/seeders/", + "Modules\\": "Modules/" } }, "autoload-dev": { diff --git a/composer.lock b/composer.lock index ce5ffcc..916fecd 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1f5b5a47e5910fdf5b2c47e1bc45e1b0", + "content-hash": "d92f21f84e06e667b70468859bfaffd0", "packages": [ { "name": "brick/math", @@ -2256,6 +2256,101 @@ ], "time": "2026-09-02T12:39:56+00:00" }, + { + "name": "mpba/laravel-modules", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/MPBA-Ltd/laravel_modules.git", + "reference": "55d802560f6404d6b9fd71a89561ed46d32124ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MPBA-Ltd/laravel_modules/zipball/55d802560f6404d6b9fd71a89561ed46d32124ff", + "reference": "55d802560f6404d6b9fd71a89561ed46d32124ff", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "laravel/framework": "^8.0", + "mockery/mockery": "~1.0", + "orchestra/testbench": "^6.0", + "phpstan/phpstan": "^0.12.14", + "phpunit/phpunit": "^8.5", + "spatie/phpunit-snapshot-assertions": "^2.1.0" + }, + "default-branch": true, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "mpba\\Modules\\LaravelModulesServiceProvider" + ], + "aliases": { + "Module": "mpba\\Modules\\Facades\\Module" + } + }, + "branch-alias": { + "dev-master": "8.0-dev" + } + }, + "autoload": { + "psr-4": { + "mpba\\Modules\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "autoload-dev": { + "psr-4": { + "mpba\\Modules\\Tests\\": "tests", + "Modules\\Recipe\\": "tests/stubs/valid/Recipe" + } + }, + "scripts": { + "update-snapshots": [ + "./vendor/bin/phpunit --no-coverage -d --update-snapshots" + ], + "test": [ + "vendor/bin/phpunit" + ], + "test-coverage": [ + "vendor/bin/phpunit --debug --coverage-html coverage" + ], + "pcf": [ + "vendor/bin/php-cs-fixer fix --verbose" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Gregory", + "email": "mark.gregory@mpba.co.uk", + "homepage": "https://mpba.co.uk", + "role": "Developer" + } + ], + "description": "Laravel Module management", + "keywords": [ + "laravel", + "module", + "modules", + "mpba", + "rad" + ], + "support": { + "source": "https://github.com/MPBA-Ltd/laravel_modules/tree/main", + "issues": "https://github.com/MPBA-Ltd/laravel_modules/issues" + }, + "time": "2026-09-30T13:50:27+00:00" + }, { "name": "nesbot/carbon", "version": "3.13.2", @@ -8709,7 +8804,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "mpba/laravel-modules": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/modules/Licensing/Config/.gitkeep b/modules/Licensing/Config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Config/config.php b/modules/Licensing/Config/config.php new file mode 100644 index 0000000..3b94eda --- /dev/null +++ b/modules/Licensing/Config/config.php @@ -0,0 +1,8 @@ + 'Licensing', + 'features' => + [ + ], +]; diff --git a/modules/Licensing/Console/.gitkeep b/modules/Licensing/Console/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Database/Migrations/.gitkeep b/modules/Licensing/Database/Migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Database/Seeders/.gitkeep b/modules/Licensing/Database/Seeders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Database/Seeders/LicensingDatabaseSeeder.php b/modules/Licensing/Database/Seeders/LicensingDatabaseSeeder.php new file mode 100644 index 0000000..fbb0b58 --- /dev/null +++ b/modules/Licensing/Database/Seeders/LicensingDatabaseSeeder.php @@ -0,0 +1,21 @@ +call("OthersTableSeeder"); + } +} diff --git a/modules/Licensing/Database/factories/.gitkeep b/modules/Licensing/Database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Helpers/.gitkeep b/modules/Licensing/Helpers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Helpers/Helper.php b/modules/Licensing/Helpers/Helper.php new file mode 100644 index 0000000..7607c60 --- /dev/null +++ b/modules/Licensing/Helpers/Helper.php @@ -0,0 +1,12 @@ +registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->registerHelpers(); + $this->registerCommands(); + $this->loadMigrationsFrom(module_path(ModuleInfo::name(), 'Database/Migrations')); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register(): void + { + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register the helpers. + * + * @return void + */ + protected function registerHelpers(): void + { + foreach (glob(__DIR__.'/../Helpers/*.php') as $filename) { + require_once $filename; + } + } + + /** + * Dynamically Register Commands. + * + * @return void + */ + public function registerCommands(): void + { + if (!$this->app->runningInConsole()) { + return; + } + $commandPath = __DIR__ . '/../Console'; + $commands = collect(File::allFiles($commandPath)) + ->map(function ($file) { + $class = 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension(); + return $class; + }) + ->filter(function ($class) { + return class_exists($class); + }) + ->values() + ->all(); + $this->commands($commands); + } + + /** + * Register config. + * + * @return void + */ + protected function registerConfig(): void + { + $this->publishes([ + module_path(ModuleInfo::name(), 'Config/config.php') => config_path( ModuleInfo::nameLower(). '.php'), + ], 'config'); + $this->mergeConfigFrom( + module_path(ModuleInfo::name(), 'Config/config.php'), ModuleInfo::nameLower() + ); + } + + /** + * Register views. + * + * @return void + */ + public function registerViews(): void + { + $viewPath = resource_path('views/modules/' . ModuleInfo::nameLower()); + $sourcePath = module_path(ModuleInfo::name(), 'Resources/views'); + $this->publishes([ + $sourcePath => $viewPath + ], ['views', ModuleInfo::nameLower() . '-module-views']); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower()); + } + + /** + * Register translations. + * + * @return void + */ + public function registerTranslations(): void + { + $langPath = resource_path('lang/modules/' . ModuleInfo::nameLower()); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, ModuleInfo::nameLower()); + } else { + $this->loadTranslationsFrom(module_path(ModuleInfo::name(), 'Resources/lang'), ModuleInfo::nameLower()); + } + } + + /** + * Regsiter View Paths + * @return array + */ + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (Config::get('view.paths') as $path) { + if (is_dir($path . '/modules/' . ModuleInfo::nameLower())) { + $paths[] = $path . '/modules/' . ModuleInfo::nameLower(); + } + } + return $paths; + } +} diff --git a/modules/Licensing/Providers/RouteServiceProvider.php b/modules/Licensing/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..c691ba8 --- /dev/null +++ b/modules/Licensing/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('Licensing', '/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('Licensing', '/Routes/api.php')); + } +} diff --git a/modules/Licensing/Resources/assets/.gitkeep b/modules/Licensing/Resources/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Resources/assets/js/app.js b/modules/Licensing/Resources/assets/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Resources/assets/sass/app.scss b/modules/Licensing/Resources/assets/sass/app.scss new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Resources/lang/.gitkeep b/modules/Licensing/Resources/lang/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Resources/views/.gitkeep b/modules/Licensing/Resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/Licensing/Resources/views/index.blade.php b/modules/Licensing/Resources/views/index.blade.php new file mode 100644 index 0000000..4277b06 --- /dev/null +++ b/modules/Licensing/Resources/views/index.blade.php @@ -0,0 +1,9 @@ +@extends('licensing::layouts.master') + +@section('content') +
+ This view is loaded from module: {!! config('licensing.name') !!} +
+@endsection diff --git a/modules/Licensing/Resources/views/layouts/master.blade.php b/modules/Licensing/Resources/views/layouts/master.blade.php new file mode 100644 index 0000000..1e51f1c --- /dev/null +++ b/modules/Licensing/Resources/views/layouts/master.blade.php @@ -0,0 +1,19 @@ + + + + + + ++ This view is loaded from module: {!! config('paddle.name') !!} +
+@endsection diff --git a/modules/Paddle/Resources/views/layouts/master.blade.php b/modules/Paddle/Resources/views/layouts/master.blade.php new file mode 100644 index 0000000..b42fb10 --- /dev/null +++ b/modules/Paddle/Resources/views/layouts/master.blade.php @@ -0,0 +1,19 @@ + + + + + + +