Compare commits

..

No commits in common. '133e16b610eaa28d381c629c483438d95c37a23f' and '0b6df835fc890a3784debcb139fd7d792f7b65c3' have entirely different histories.

  1. 0
      Modules/Api/app/Http/Controllers/.gitkeep
  2. 56
      Modules/Api/app/Http/Controllers/ApiController.php
  3. 0
      Modules/Api/app/Providers/.gitkeep
  4. 154
      Modules/Api/app/Providers/ApiServiceProvider.php
  5. 27
      Modules/Api/app/Providers/EventServiceProvider.php
  6. 50
      Modules/Api/app/Providers/RouteServiceProvider.php
  7. 30
      Modules/Api/composer.json
  8. 0
      Modules/Api/config/.gitkeep
  9. 5
      Modules/Api/config/config.php
  10. 0
      Modules/Api/database/factories/.gitkeep
  11. 0
      Modules/Api/database/migrations/.gitkeep
  12. 0
      Modules/Api/database/seeders/.gitkeep
  13. 16
      Modules/Api/database/seeders/ApiDatabaseSeeder.php
  14. 16
      Modules/Api/module.json
  15. 15
      Modules/Api/package.json
  16. 0
      Modules/Api/resources/assets/.gitkeep
  17. 0
      Modules/Api/resources/assets/js/app.js
  18. 0
      Modules/Api/resources/assets/sass/app.scss
  19. 0
      Modules/Api/resources/views/.gitkeep
  20. 29
      Modules/Api/resources/views/components/layouts/master.blade.php
  21. 5
      Modules/Api/resources/views/index.blade.php
  22. 0
      Modules/Api/routes/.gitkeep
  23. 8
      Modules/Api/routes/api.php
  24. 8
      Modules/Api/routes/web.php
  25. 0
      Modules/Api/tests/Feature/.gitkeep
  26. 0
      Modules/Api/tests/Unit/.gitkeep
  27. 57
      Modules/Api/vite.config.js
  28. 4
      composer.json
  29. 147
      composer.lock
  30. 298
      config/modules.php
  31. 3
      modules_statuses.json
  32. 8
      stubs/nwidart-stubs/action-invoke.stub
  33. 8
      stubs/nwidart-stubs/action.stub
  34. 0
      stubs/nwidart-stubs/assets/js/app.stub
  35. 0
      stubs/nwidart-stubs/assets/sass/app.stub
  36. 25
      stubs/nwidart-stubs/cast.stub
  37. 16
      stubs/nwidart-stubs/channel.stub
  38. 8
      stubs/nwidart-stubs/class-invoke.stub
  39. 8
      stubs/nwidart-stubs/class.stub
  40. 53
      stubs/nwidart-stubs/command.stub
  41. 22
      stubs/nwidart-stubs/component-class.stub
  42. 3
      stubs/nwidart-stubs/component-view.stub
  43. 30
      stubs/nwidart-stubs/composer.stub
  44. 59
      stubs/nwidart-stubs/controller-api.stub
  45. 7
      stubs/nwidart-stubs/controller-plain.stub
  46. 17
      stubs/nwidart-stubs/controller.invokable.stub
  47. 56
      stubs/nwidart-stubs/controller.stub
  48. 5
      stubs/nwidart-stubs/enum.stub
  49. 27
      stubs/nwidart-stubs/event-provider.stub
  50. 31
      stubs/nwidart-stubs/event.stub
  51. 20
      stubs/nwidart-stubs/exception-render-report.stub
  52. 15
      stubs/nwidart-stubs/exception-render.stub
  53. 13
      stubs/nwidart-stubs/exception-report.stub
  54. 7
      stubs/nwidart-stubs/exception.stub
  55. 22
      stubs/nwidart-stubs/factory.stub
  56. 8
      stubs/nwidart-stubs/helper-invoke.stub
  57. 8
      stubs/nwidart-stubs/helper.stub
  58. 5
      stubs/nwidart-stubs/interface.stub
  59. 24
      stubs/nwidart-stubs/job-queued.stub
  60. 21
      stubs/nwidart-stubs/job.stub
  61. 11
      stubs/nwidart-stubs/json.stub
  62. 19
      stubs/nwidart-stubs/listener-duck.stub
  63. 21
      stubs/nwidart-stubs/listener-queued-duck.stub
  64. 22
      stubs/nwidart-stubs/listener-queued.stub
  65. 20
      stubs/nwidart-stubs/listener.stub
  66. 26
      stubs/nwidart-stubs/mail.stub
  67. 17
      stubs/nwidart-stubs/middleware.stub
  68. 28
      stubs/nwidart-stubs/migration/add.stub
  69. 28
      stubs/nwidart-stubs/migration/create.stub
  70. 28
      stubs/nwidart-stubs/migration/delete.stub
  71. 28
      stubs/nwidart-stubs/migration/drop.stub
  72. 18
      stubs/nwidart-stubs/migration/plain.stub
  73. 22
      stubs/nwidart-stubs/model.stub
  74. 45
      stubs/nwidart-stubs/notification.stub
  75. 33
      stubs/nwidart-stubs/observer.stub
  76. 15
      stubs/nwidart-stubs/package.stub
  77. 15
      stubs/nwidart-stubs/policy.plain.stub
  78. 21
      stubs/nwidart-stubs/provider.stub
  79. 8
      stubs/nwidart-stubs/repository-invoke.stub
  80. 8
      stubs/nwidart-stubs/repository.stub
  81. 24
      stubs/nwidart-stubs/request.stub
  82. 17
      stubs/nwidart-stubs/resource-collection.stub
  83. 17
      stubs/nwidart-stubs/resource.stub
  84. 50
      stubs/nwidart-stubs/route-provider.stub
  85. 8
      stubs/nwidart-stubs/routes/api.stub
  86. 8
      stubs/nwidart-stubs/routes/web.stub
  87. 19
      stubs/nwidart-stubs/rule.implicit.stub
  88. 14
      stubs/nwidart-stubs/rule.stub
  89. 5
      stubs/nwidart-stubs/scaffold/config.stub
  90. 154
      stubs/nwidart-stubs/scaffold/provider.stub
  91. 15
      stubs/nwidart-stubs/scope.stub
  92. 16
      stubs/nwidart-stubs/seeder.stub
  93. 8
      stubs/nwidart-stubs/service-invoke.stub
  94. 8
      stubs/nwidart-stubs/service.stub
  95. 18
      stubs/nwidart-stubs/tests/feature.stub
  96. 16
      stubs/nwidart-stubs/tests/unit.stub
  97. 5
      stubs/nwidart-stubs/trait.stub
  98. 3
      stubs/nwidart-stubs/view.stub
  99. 5
      stubs/nwidart-stubs/views/index.stub
  100. 29
      stubs/nwidart-stubs/views/master.stub
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,56 +0,0 @@
<?php
namespace Modules\Api\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class ApiController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('api::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('api::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request) {}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('api::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('api::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id) {}
/**
* Remove the specified resource from storage.
*/
public function destroy($id) {}
}

@ -1,154 +0,0 @@
<?php
namespace Modules\Api\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Nwidart\Modules\Traits\PathNamespace;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
class ApiServiceProvider extends ServiceProvider
{
use PathNamespace;
protected string $name = 'Api';
protected string $nameLower = 'api';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->name, 'database/migrations'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->register(EventServiceProvider::class);
$this->app->register(RouteServiceProvider::class);
}
/**
* Register commands in the format of Command::class
*/
protected function registerCommands(): void
{
// $this->commands([]);
}
/**
* Register command Schedules.
*/
protected function registerCommandSchedules(): void
{
// $this->app->booted(function () {
// $schedule = $this->app->make(Schedule::class);
// $schedule->command('inspire')->hourly();
// });
}
/**
* Register translations.
*/
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/'.$this->nameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->nameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower);
$this->loadJsonTranslationsFrom(module_path($this->name, 'lang'));
}
}
/**
* Register config.
*/
protected function registerConfig(): void
{
$configPath = module_path($this->name, config('modules.paths.generator.config.path'));
if (is_dir($configPath)) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath));
foreach ($iterator as $file) {
if ($file->isFile() && $file->getExtension() === 'php') {
$config = str_replace($configPath.DIRECTORY_SEPARATOR, '', $file->getPathname());
$config_key = str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $config);
$segments = explode('.', $this->nameLower.'.'.$config_key);
// Remove duplicated adjacent segments
$normalized = [];
foreach ($segments as $segment) {
if (end($normalized) !== $segment) {
$normalized[] = $segment;
}
}
$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);
$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}
/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;
config([$key => array_replace_recursive($existing, $module_config)]);
}
/**
* Register views.
*/
public function registerViews(): void
{
$viewPath = resource_path('views/modules/'.$this->nameLower);
$sourcePath = module_path($this->name, 'resources/views');
$this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower);
Blade::componentNamespace(config('modules.namespace').'\\' . $this->name . '\\View\\Components', $this->nameLower);
}
/**
* Get the services provided by the provider.
*/
public function provides(): array
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (config('view.paths') as $path) {
if (is_dir($path.'/modules/'.$this->nameLower)) {
$paths[] = $path.'/modules/'.$this->nameLower;
}
}
return $paths;
}
}

@ -1,27 +0,0 @@
<?php
namespace Modules\Api\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event handler mappings for the application.
*
* @var array<string, array<int, string>>
*/
protected $listen = [];
/**
* Indicates if events should be discovered.
*
* @var bool
*/
protected static $shouldDiscoverEvents = true;
/**
* Configure the proper event listeners for email verification.
*/
protected function configureEmailVerification(): void {}
}

@ -1,50 +0,0 @@
<?php
namespace Modules\Api\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
protected string $name = 'Api';
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')->group(module_path($this->name, '/routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php'));
}
}

@ -1,30 +0,0 @@
{
"name": "nwidart/api",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Api\\": "app/",
"Modules\\Api\\Database\\Factories\\": "database/factories/",
"Modules\\Api\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Api\\Tests\\": "tests/"
}
}
}

@ -1,5 +0,0 @@
<?php
return [
'name' => 'Api',
];

@ -1,16 +0,0 @@
<?php
namespace Modules\Api\Database\Seeders;
use Illuminate\Database\Seeder;
class ApiDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

@ -1,16 +0,0 @@
{
"name": "modules/api",
"description": "",
"type": "module",
"autoload": {
"psr-4": {
"Modules\\Api\\": "app/"
}
},
"extra": {
"laravel": {
"providers": []
}
},
"require": {}
}

@ -1,15 +0,0 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5",
"sass": "^1.69.5",
"postcss": "^8.3.7",
"vite": "^4.0.0"
}
}

@ -1,29 +0,0 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Api Module - {{ config('app.name', 'Laravel') }}</title>
<meta name="description" content="{{ $description ?? '' }}">
<meta name="keywords" content="{{ $keywords ?? '' }}">
<meta name="author" content="{{ $author ?? '' }}">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
{{-- Vite CSS --}}
{{-- {{ module_vite('build-api', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
{{ $slot }}
{{-- Vite JS --}}
{{-- {{ module_vite('build-api', 'resources/assets/js/app.js') }} --}}
</body>

@ -1,5 +0,0 @@
<x-api::layouts.master>
<h1>Hello World</h1>
<p>Module: {!! config('api.name') !!}</p>
</x-api::layouts.master>

@ -1,8 +0,0 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Api\Http\Controllers\ApiController;
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
Route::apiResource('apis', ApiController::class)->names('api');
});

@ -1,8 +0,0 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Api\Http\Controllers\ApiController;
Route::middleware(['auth', 'verified'])->group(function () {
Route::resource('apis', ApiController::class)->names('api');
});

@ -1,57 +0,0 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import { readdirSync, statSync } from 'fs';
import { join,relative,dirname } from 'path';
import { fileURLToPath } from 'url';
export default defineConfig({
build: {
outDir: '../../public/build-api',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-api',
input: [
__dirname + '/resources/assets/sass/app.scss',
__dirname + '/resources/assets/js/app.js'
],
refresh: true,
}),
],
});
// Scen all resources for assets file. Return array
//function getFilePaths(dir) {
// const filePaths = [];
//
// function walkDirectory(currentPath) {
// const files = readdirSync(currentPath);
// for (const file of files) {
// const filePath = join(currentPath, file);
// const stats = statSync(filePath);
// if (stats.isFile() && !file.startsWith('.')) {
// const relativePath = 'Modules/Api/'+relative(__dirname, filePath);
// filePaths.push(relativePath);
// } else if (stats.isDirectory()) {
// walkDirectory(filePath);
// }
// }
// }
//
// walkDirectory(dir);
// return filePaths;
//}
//const __filename = fileURLToPath(import.meta.url);
//const __dirname = dirname(__filename);
//const assetsDir = join(__dirname, 'resources/assets');
//export const paths = getFilePaths(assetsDir);
//export const paths = [
// 'Modules/Api/resources/assets/sass/app.scss',
// 'Modules/Api/resources/assets/js/app.js',
//];

@ -11,7 +11,6 @@
"laravel/passport": "^12.4", "laravel/passport": "^12.4",
"laravel/tinker": "^2.10.1", "laravel/tinker": "^2.10.1",
"livewire/livewire": "^3.6", "livewire/livewire": "^3.6",
"nwidart/laravel-modules": "^12.0",
"nyholm/psr7": "^1.8", "nyholm/psr7": "^1.8",
"spatie/laravel-permission": "^6.20", "spatie/laravel-permission": "^6.20",
"symfony/psr-http-message-bridge": "^7.3" "symfony/psr-http-message-bridge": "^7.3"
@ -74,8 +73,7 @@
"sort-packages": true, "sort-packages": true,
"allow-plugins": { "allow-plugins": {
"pestphp/pest-plugin": true, "pestphp/pest-plugin": true,
"php-http/discovery": true, "php-http/discovery": true
"wikimedia/composer-merge-plugin": true
} }
}, },
"minimum-stability": "stable", "minimum-stability": "stable",

147
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "fd38e7434ec17abb4278b799dc697955", "content-hash": "cab1c382923bf6277224fee0983b7899",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -3068,95 +3068,6 @@
], ],
"time": "2025-05-08T08:14:37+00:00" "time": "2025-05-08T08:14:37+00:00"
}, },
{
"name": "nwidart/laravel-modules",
"version": "v12.0.3",
"source": {
"type": "git",
"url": "https://github.com/nWidart/laravel-modules.git",
"reference": "ffad5c797e6a11d0e2d9a1bad422fa456589531e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/ffad5c797e6a11d0e2d9a1bad422fa456589531e",
"reference": "ffad5c797e6a11d0e2d9a1bad422fa456589531e",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-simplexml": "*",
"php": ">=8.2",
"wikimedia/composer-merge-plugin": "^2.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^v3.52",
"laravel/framework": "^v12.0",
"laravel/pint": "^1.16",
"mockery/mockery": "^1.6",
"orchestra/testbench": "^v10.0",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^11.5.3|^12.0.",
"spatie/phpunit-snapshot-assertions": "^5.0"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Module": "Nwidart\\Modules\\Facades\\Module"
},
"providers": [
"Nwidart\\Modules\\LaravelModulesServiceProvider"
]
},
"branch-alias": {
"dev-master": "12.x-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Nwidart\\Modules\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com",
"homepage": "https://nicolaswidart.com",
"role": "Developer"
}
],
"description": "Laravel Module management",
"keywords": [
"laravel",
"module",
"modules",
"nwidart",
"rad"
],
"support": {
"issues": "https://github.com/nWidart/laravel-modules/issues",
"source": "https://github.com/nWidart/laravel-modules/tree/v12.0.3"
},
"funding": [
{
"url": "https://github.com/dcblogdev",
"type": "github"
},
{
"url": "https://github.com/nwidart",
"type": "github"
}
],
"time": "2025-04-28T07:57:29+00:00"
},
{ {
"name": "nyholm/psr7", "name": "nyholm/psr7",
"version": "1.8.2", "version": "1.8.2",
@ -6898,62 +6809,6 @@
"source": "https://github.com/webmozarts/assert/tree/1.11.0" "source": "https://github.com/webmozarts/assert/tree/1.11.0"
}, },
"time": "2022-06-03T18:03:27+00:00" "time": "2022-06-03T18:03:27+00:00"
},
{
"name": "wikimedia/composer-merge-plugin",
"version": "v2.1.0",
"source": {
"type": "git",
"url": "https://github.com/wikimedia/composer-merge-plugin.git",
"reference": "a03d426c8e9fb2c9c569d9deeb31a083292788bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wikimedia/composer-merge-plugin/zipball/a03d426c8e9fb2c9c569d9deeb31a083292788bc",
"reference": "a03d426c8e9fb2c9c569d9deeb31a083292788bc",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.1||^2.0",
"php": ">=7.2.0"
},
"require-dev": {
"composer/composer": "^1.1||^2.0",
"ext-json": "*",
"mediawiki/mediawiki-phan-config": "0.11.1",
"php-parallel-lint/php-parallel-lint": "~1.3.1",
"phpspec/prophecy": "~1.15.0",
"phpunit/phpunit": "^8.5||^9.0",
"squizlabs/php_codesniffer": "~3.7.1"
},
"type": "composer-plugin",
"extra": {
"class": "Wikimedia\\Composer\\Merge\\V2\\MergePlugin",
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"Wikimedia\\Composer\\Merge\\V2\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bryan Davis",
"email": "bd808@wikimedia.org"
}
],
"description": "Composer plugin to merge multiple composer.json files",
"support": {
"issues": "https://github.com/wikimedia/composer-merge-plugin/issues",
"source": "https://github.com/wikimedia/composer-merge-plugin/tree/v2.1.0"
},
"time": "2023-04-15T19:07:00+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [

@ -1,298 +0,0 @@
<?php
use Nwidart\Modules\Activators\FileActivator;
use Nwidart\Modules\Providers\ConsoleServiceProvider;
return [
/*
|--------------------------------------------------------------------------
| Module Namespace
|--------------------------------------------------------------------------
|
| Default module namespace.
|
*/
'namespace' => 'Modules',
/*
|--------------------------------------------------------------------------
| Module Stubs
|--------------------------------------------------------------------------
|
| Default module stubs.
|
*/
'stubs' => [
'enabled' => false,
'path' => base_path('vendor/nwidart/laravel-modules/src/Commands/stubs'),
'files' => [
'routes/web' => 'routes/web.php',
'routes/api' => 'routes/api.php',
'views/index' => 'resources/views/index.blade.php',
'views/master' => 'resources/views/components/layouts/master.blade.php',
'scaffold/config' => 'config/config.php',
'composer' => 'composer.json',
'assets/js/app' => 'resources/assets/js/app.js',
'assets/sass/app' => 'resources/assets/sass/app.scss',
'vite' => 'vite.config.js',
'package' => 'package.json',
],
'replacements' => [
/**
* Define custom replacements for each section.
* You can specify a closure for dynamic values.
*
* Example:
*
* 'composer' => [
* 'CUSTOM_KEY' => fn (\Nwidart\Modules\Generators\ModuleGenerator $generator) => $generator->getModule()->getLowerName() . '-module',
* 'CUSTOM_KEY2' => fn () => 'custom text',
* 'LOWER_NAME',
* 'STUDLY_NAME',
* // ...
* ],
*
* Note: Keys should be in UPPERCASE.
*/
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME', 'PLURAL_LOWER_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
'routes/api' => ['LOWER_NAME', 'STUDLY_NAME', 'PLURAL_LOWER_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'CONTROLLER_NAMESPACE'],
'vite' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME'],
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
'views/index' => ['LOWER_NAME'],
'views/master' => ['LOWER_NAME', 'STUDLY_NAME', 'KEBAB_NAME'],
'scaffold/config' => ['STUDLY_NAME'],
'composer' => [
'LOWER_NAME',
'STUDLY_NAME',
'VENDOR',
'AUTHOR_NAME',
'AUTHOR_EMAIL',
'MODULE_NAMESPACE',
'PROVIDER_NAMESPACE',
'APP_FOLDER_NAME',
],
],
'gitkeep' => true,
],
'paths' => [
/*
|--------------------------------------------------------------------------
| Modules path
|--------------------------------------------------------------------------
|
| This path is used to save the generated module.
| This path will also be added automatically to the list of scanned folders.
|
*/
'modules' => base_path('Modules'),
/*
|--------------------------------------------------------------------------
| Modules assets path
|--------------------------------------------------------------------------
|
| Here you may update the modules' assets path.
|
*/
'assets' => public_path('modules'),
/*
|--------------------------------------------------------------------------
| The migrations' path
|--------------------------------------------------------------------------
|
| Where you run the 'module:publish-migration' command, where do you publish the
| the migration files?
|
*/
'migration' => base_path('database/migrations'),
/*
|--------------------------------------------------------------------------
| The app path
|--------------------------------------------------------------------------
|
| app folder name
| for example can change it to 'src' or 'App'
*/
'app_folder' => 'app/',
/*
|--------------------------------------------------------------------------
| Generator path
|--------------------------------------------------------------------------
| Customise the paths where the folders will be generated.
| Setting the generate key to false will not generate that folder
*/
'generator' => [
// app/
'actions' => ['path' => 'app/Actions', 'generate' => false],
'casts' => ['path' => 'app/Casts', 'generate' => false],
'channels' => ['path' => 'app/Broadcasting', 'generate' => false],
'class' => ['path' => 'app/Classes', 'generate' => false],
'command' => ['path' => 'app/Console', 'generate' => false],
'component-class' => ['path' => 'app/View/Components', 'generate' => false],
'emails' => ['path' => 'app/Emails', 'generate' => false],
'event' => ['path' => 'app/Events', 'generate' => false],
'enums' => ['path' => 'app/Enums', 'generate' => false],
'exceptions' => ['path' => 'app/Exceptions', 'generate' => false],
'jobs' => ['path' => 'app/Jobs', 'generate' => false],
'helpers' => ['path' => 'app/Helpers', 'generate' => false],
'interfaces' => ['path' => 'app/Interfaces', 'generate' => false],
'listener' => ['path' => 'app/Listeners', 'generate' => false],
'model' => ['path' => 'app/Models', 'generate' => false],
'notifications' => ['path' => 'app/Notifications', 'generate' => false],
'observer' => ['path' => 'app/Observers', 'generate' => false],
'policies' => ['path' => 'app/Policies', 'generate' => false],
'provider' => ['path' => 'app/Providers', 'generate' => true],
'repository' => ['path' => 'app/Repositories', 'generate' => false],
'resource' => ['path' => 'app/Transformers', 'generate' => false],
'route-provider' => ['path' => 'app/Providers', 'generate' => true],
'rules' => ['path' => 'app/Rules', 'generate' => false],
'services' => ['path' => 'app/Services', 'generate' => false],
'scopes' => ['path' => 'app/Models/Scopes', 'generate' => false],
'traits' => ['path' => 'app/Traits', 'generate' => false],
// app/Http/
'controller' => ['path' => 'app/Http/Controllers', 'generate' => true],
'filter' => ['path' => 'app/Http/Middleware', 'generate' => false],
'request' => ['path' => 'app/Http/Requests', 'generate' => false],
// config/
'config' => ['path' => 'config', 'generate' => true],
// database/
'factory' => ['path' => 'database/factories', 'generate' => true],
'migration' => ['path' => 'database/migrations', 'generate' => true],
'seeder' => ['path' => 'database/seeders', 'generate' => true],
// lang/
'lang' => ['path' => 'lang', 'generate' => false],
// resource/
'assets' => ['path' => 'resources/assets', 'generate' => true],
'component-view' => ['path' => 'resources/views/components', 'generate' => false],
'views' => ['path' => 'resources/views', 'generate' => true],
// routes/
'routes' => ['path' => 'routes', 'generate' => true],
// tests/
'test-feature' => ['path' => 'tests/Feature', 'generate' => true],
'test-unit' => ['path' => 'tests/Unit', 'generate' => true],
],
],
/*
|--------------------------------------------------------------------------
| Auto Discover of Modules
|--------------------------------------------------------------------------
|
| Here you configure auto discover of module
| This is useful for simplify module providers.
|
*/
'auto-discover' => [
/*
|--------------------------------------------------------------------------
| Migrations
|--------------------------------------------------------------------------
|
| This option for register migration automatically.
|
*/
'migrations' => true,
/*
|--------------------------------------------------------------------------
| Translations
|--------------------------------------------------------------------------
|
| This option for register lang file automatically.
|
*/
'translations' => false,
],
/*
|--------------------------------------------------------------------------
| Package commands
|--------------------------------------------------------------------------
|
| Here you can define which commands will be visible and used in your
| application. You can add your own commands to merge section.
|
*/
'commands' => ConsoleServiceProvider::defaultCommands()
->merge([
// New commands go here
])->toArray(),
/*
|--------------------------------------------------------------------------
| Scan Path
|--------------------------------------------------------------------------
|
| Here you define which folder will be scanned. By default will scan vendor
| directory. This is useful if you host the package in packagist website.
|
*/
'scan' => [
'enabled' => false,
'paths' => [
base_path('vendor/*/*'),
],
],
/*
|--------------------------------------------------------------------------
| Composer File Template
|--------------------------------------------------------------------------
|
| Here is the config for the composer.json file, generated by this package
|
*/
'composer' => [
'vendor' => env('MODULE_VENDOR', 'nwidart'),
'author' => [
'name' => env('MODULE_AUTHOR_NAME', 'Nicolas Widart'),
'email' => env('MODULE_AUTHOR_EMAIL', 'n.widart@gmail.com'),
],
'composer-output' => false,
],
/*
|--------------------------------------------------------------------------
| Choose what laravel-modules will register as custom namespaces.
| Setting one to false will require you to register that part
| in your own Service Provider class.
|--------------------------------------------------------------------------
*/
'register' => [
'translations' => true,
/**
* load files on boot or register method
*/
'files' => 'register',
],
/*
|--------------------------------------------------------------------------
| Activators
|--------------------------------------------------------------------------
|
| You can define new types of activators here, file, database, etc. The only
| required parameter is 'class'.
| The file activator will store the activation status in storage/installed_modules
*/
'activators' => [
'file' => [
'class' => FileActivator::class,
'statuses-file' => base_path('modules_statuses.json'),
],
],
'activator' => 'file',
];

@ -1,3 +0,0 @@
{
"Api": true
}

@ -1,8 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
class $CLASS$
{
public function __invoke() {}
}

@ -1,8 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
class $CLASS$
{
public function handle() {}
}

@ -1,25 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Database\Eloquent\Model;
class $CLASS$ implements CastsAttributes
{
/**
* Cast the given value.
*/
public function get(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}
/**
* Prepare the given value for storage.
*/
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
{
return $value;
}
}

@ -1,16 +0,0 @@
<?php
namespace $NAMESPACE$;
class $CLASS$
{
/**
* Create a new channel instance.
*/
public function __construct() {}
/**
* Authenticate the user's access to the channel.
*/
public function join(Operator $user): array|bool {}
}

@ -1,8 +0,0 @@
<?php
namespace $NAMESPACE$;
class $CLASS$
{
public function __invoke() {}
}

@ -1,8 +0,0 @@
<?php
namespace $NAMESPACE$;
class $CLASS$
{
public function __construct() {}
}

@ -1,53 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class $CLASS$ extends Command
{
/**
* The name and signature of the console command.
*/
protected $signature = '$COMMAND_NAME$';
/**
* The console command description.
*/
protected $description = 'Command description.';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle() {}
/**
* Get the console command arguments.
*/
protected function getArguments(): array
{
return [
['example', InputArgument::REQUIRED, 'An example argument.'],
];
}
/**
* Get the console command options.
*/
protected function getOptions(): array
{
return [
['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null],
];
}
}

@ -1,22 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\View\Component;
use Illuminate\View\View;
class $CLASS$ extends Component
{
/**
* Create a new component instance.
*/
public function __construct() {}
/**
* Get the view/contents that represent the component.
*/
public function render(): View|string
{
return view('$LOWER_NAME$::$COMPONENT_NAME$');
}
}

@ -1,3 +0,0 @@
<div>
<!-- $QUOTE$ -->
</div>

@ -1,30 +0,0 @@
{
"name": "$VENDOR$/$LOWER_NAME$",
"description": "",
"authors": [
{
"name": "$AUTHOR_NAME$",
"email": "$AUTHOR_EMAIL$"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": "$APP_FOLDER_NAME$",
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Database\\Factories\\": "database/factories/",
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Tests\\": "tests/"
}
}
}

@ -1,59 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class $CLASS$ extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
return response()->json([]);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
return response()->json([]);
}
/**
* Show the specified resource.
*/
public function show($id)
{
//
return response()->json([]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
//
return response()->json([]);
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
return response()->json([]);
}
}

@ -1,7 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use Illuminate\Routing\Controller;
class $CLASS$ extends Controller {}

@ -1,17 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class $CLASS$ extends Controller
{
/**
* Handle the incoming request.
*/
public function __invoke(Request $request)
{
return response()->json([]);
}
}

@ -1,56 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class $CLASS$ extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('$LOWER_NAME$::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('$LOWER_NAME$::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request) {}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('$LOWER_NAME$::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('$LOWER_NAME$::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id) {}
/**
* Remove the specified resource from storage.
*/
public function destroy($id) {}
}

@ -1,5 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
enum $CLASS$ {}

@ -1,27 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class $CLASS$ extends ServiceProvider
{
/**
* The event handler mappings for the application.
*
* @var array<string, array<int, string>>
*/
protected $listen = [];
/**
* Indicates if events should be discovered.
*
* @var bool
*/
protected static $shouldDiscoverEvents = true;
/**
* Configure the proper event listeners for email verification.
*/
protected function configureEmailVerification(): void {}
}

@ -1,31 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class $CLASS$
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*/
public function __construct() {}
/**
* Get the channels the event should be broadcast on.
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}

@ -1,20 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class $CLASS$ extends Exception
{
/**
* Report the exception.
*/
public function report(): void {}
/**
* Render the exception as an HTTP response.
*/
public function render(Request $request): Response {}
}

@ -1,15 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class $CLASS$ extends Exception
{
/**
* Render the exception as an HTTP response.
*/
public function render(Request $request): Response {}
}

@ -1,13 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use Exception;
class $CLASS$ extends Exception
{
/**
* Report the exception.
*/
public function report(): void {}
}

@ -1,7 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use Exception;
class $CLASS$ extends Exception {}

@ -1,22 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Database\Eloquent\Factories\Factory;
class $NAME$Factory extends Factory
{
/**
* The name of the factory's corresponding model.
*/
protected $model = \$MODEL_NAMESPACE$\$NAME$::class;
/**
* Define the model's default state.
*/
public function definition(): array
{
return [];
}
}

@ -1,8 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
class $CLASS$
{
public function __invoke() {}
}

@ -1,8 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
class $CLASS$
{
public function handle() {}
}

@ -1,5 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
interface $CLASS$ {}

@ -1,24 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
class $CLASS$ implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct() {}
/**
* Execute the job.
*/
public function handle(): void {}
}

@ -1,21 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Bus\Queueable;
use Illuminate\Foundation\Bus\Dispatchable;
class $CLASS$ implements ShouldQueue
{
use Dispatchable, Queueable;
/**
* Create a new job instance.
*/
public function __construct() {}
/**
* Execute the job.
*/
public function handle(): void {}
}

@ -1,11 +0,0 @@
{
"name": "$STUDLY_NAME$",
"alias": "$LOWER_NAME$",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\$PROVIDER_NAMESPACE$\\$STUDLY_NAME$ServiceProvider"
],
"files": []
}

@ -1,19 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class $CLASS$
{
/**
* Create the event listener.
*/
public function __construct() {}
/**
* Handle the event.
*/
public function handle($event): void {}
}

@ -1,21 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class $CLASS$ implements ShouldQueue
{
use InteractsWithQueue;
/**
* Create the event listener
*/
public function __construct() {}
/**
* Handle the event.
*/
public function handle($event): void {}
}

@ -1,22 +0,0 @@
<?php
namespace $NAMESPACE$;
use $EVENTNAME$;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class $CLASS$ implements ShouldQueue
{
use InteractsWithQueue;
/**
* Create the event listener.
*/
public function __construct() {}
/**
* Handle the event.
*/
public function handle($SHORTEVENTNAME$ $event): void {}
}

@ -1,20 +0,0 @@
<?php
namespace $NAMESPACE$;
use $EVENTNAME$;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class $CLASS$
{
/**
* Create the event listener.
*/
public function __construct() {}
/**
* Handle the event.
*/
public function handle($SHORTEVENTNAME$ $event): void {}
}

@ -1,26 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class $CLASS$ extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public function __construct() {}
/**
* Build the message.
*/
public function build(): self
{
return $this->view('view.name');
}
}

@ -1,17 +0,0 @@
<?php
namespace $NAMESPACE$;
use Closure;
use Illuminate\Http\Request;
class $CLASS$
{
/**
* Handle an incoming request.
*/
public function handle(Request $request, Closure $next)
{
return $next($request);
}
}

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('$TABLE$', function (Blueprint $table) {
$FIELDS_UP$
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('$TABLE$', function (Blueprint $table) {
$FIELDS_DOWN$
});
}
};

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('$TABLE$', function (Blueprint $table) {
$table->id();
$FIELDS$
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('$TABLE$');
}
};

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('$TABLE$', function (Blueprint $table) {
$FIELDS_UP$
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('$TABLE$', function (Blueprint $table) {
$FIELDS_DOWN$
});
}
};

@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::dropIfExists('$TABLE$');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::create('$TABLE$', function (Blueprint $table) {
$table->id();
$FIELDS$
$table->timestamps();
});
}
};

@ -1,18 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void {}
/**
* Reverse the migrations.
*/
public function down(): void {}
};

@ -1,22 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
// use $MODULE_NAMESPACE$\$MODULE$\Database\Factories\$NAME$Factory;
class $CLASS$ extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = $FILLABLE$;
// protected static function newFactory(): $NAME$Factory
// {
// // return $NAME$Factory::new();
// }
}

@ -1,45 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
class $CLASS$ extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct() {}
/**
* Get the notification's delivery channels.
*/
public function via($notifiable): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail($notifiable): MailMessage
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', 'https://laravel.com')
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*/
public function toArray($notifiable): array
{
return [];
}
}

@ -1,33 +0,0 @@
<?php
namespace $NAMESPACE$;
use $MODEL_NAMESPACE$\$NAME$;
class $NAME$Observer
{
/**
* Handle the $NAME$ "created" event.
*/
public function created($NAME$ $NAME_VARIABLE$): void {}
/**
* Handle the $NAME$ "updated" event.
*/
public function updated($NAME$ $NAME_VARIABLE$): void {}
/**
* Handle the $NAME$ "deleted" event.
*/
public function deleted($NAME$ $NAME_VARIABLE$): void {}
/**
* Handle the $NAME$ "restored" event.
*/
public function restored($NAME$ $NAME_VARIABLE$): void {}
/**
* Handle the $NAME$ "force deleted" event.
*/
public function forceDeleted($NAME$ $NAME_VARIABLE$): void {}
}

@ -1,15 +0,0 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5",
"sass": "^1.69.5",
"postcss": "^8.3.7",
"vite": "^4.0.0"
}
}

@ -1,15 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Auth\Access\HandlesAuthorization;
class $CLASS$
{
use HandlesAuthorization;
/**
* Create a new policy instance.
*/
public function __construct() {}
}

@ -1,21 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Support\ServiceProvider;
class $CLASS$ extends ServiceProvider
{
/**
* Register the service provider.
*/
public function register(): void {}
/**
* Get the services provided by the provider.
*/
public function provides(): array
{
return [];
}
}

@ -1,8 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
class $CLASS$
{
public function __invoke() {}
}

@ -1,8 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
class $CLASS$
{
public function handle() {}
}

@ -1,24 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Foundation\Http\FormRequest;
class $CLASS$ extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [];
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
}

@ -1,17 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
class $CLASS$ extends ResourceCollection
{
/**
* Transform the resource collection into an array.
*/
public function toArray(Request $request): array
{
return parent::toArray($request);
}
}

@ -1,17 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class $CLASS$ extends JsonResource
{
/**
* Transform the resource into an array.
*/
public function toArray(Request $request): array
{
return parent::toArray($request);
}
}

@ -1,50 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
class $CLASS$ extends ServiceProvider
{
protected string $name = '$MODULE$';
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')->group(module_path($this->name, '$WEB_ROUTES_PATH$'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '$API_ROUTES_PATH$'));
}
}

@ -1,8 +0,0 @@
<?php
use Illuminate\Support\Facades\Route;
use $MODULE_NAMESPACE$\$STUDLY_NAME$\$CONTROLLER_NAMESPACE$\$STUDLY_NAME$Controller;
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
Route::apiResource('$PLURAL_LOWER_NAME$', $STUDLY_NAME$Controller::class)->names('$LOWER_NAME$');
});

@ -1,8 +0,0 @@
<?php
use Illuminate\Support\Facades\Route;
use $MODULE_NAMESPACE$\$STUDLY_NAME$\$CONTROLLER_NAMESPACE$\$STUDLY_NAME$Controller;
Route::middleware(['auth', 'verified'])->group(function () {
Route::resource('$PLURAL_LOWER_NAME$', $STUDLY_NAME$Controller::class)->names('$LOWER_NAME$');
});

@ -1,19 +0,0 @@
<?php
namespace $NAMESPACE$;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class $CLASS$ implements ValidationRule
{
/**
* Indicates whether the rule should be implicit.
*/
public bool $implicit = true;
/**
* Run the validation rule.
*/
public function validate(string $attribute, mixed $value, Closure $fail): void {}
}

@ -1,14 +0,0 @@
<?php
namespace $NAMESPACE$;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class $CLASS$ implements ValidationRule
{
/**
* Run the validation rule.
*/
public function validate(string $attribute, mixed $value, Closure $fail): void {}
}

@ -1,5 +0,0 @@
<?php
return [
'name' => '$STUDLY_NAME$',
];

@ -1,154 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Nwidart\Modules\Traits\PathNamespace;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
class $CLASS$ extends ServiceProvider
{
use PathNamespace;
protected string $name = '$MODULE$';
protected string $nameLower = '$LOWER_NAME$';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->name, '$MIGRATIONS_PATH$'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->register(EventServiceProvider::class);
$this->app->register(RouteServiceProvider::class);
}
/**
* Register commands in the format of Command::class
*/
protected function registerCommands(): void
{
// $this->commands([]);
}
/**
* Register command Schedules.
*/
protected function registerCommandSchedules(): void
{
// $this->app->booted(function () {
// $schedule = $this->app->make(Schedule::class);
// $schedule->command('inspire')->hourly();
// });
}
/**
* Register translations.
*/
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/'.$this->nameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->nameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->name, '$PATH_LANG$'), $this->nameLower);
$this->loadJsonTranslationsFrom(module_path($this->name, '$PATH_LANG$'));
}
}
/**
* Register config.
*/
protected function registerConfig(): void
{
$configPath = module_path($this->name, config('modules.paths.generator.config.path'));
if (is_dir($configPath)) {
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath));
foreach ($iterator as $file) {
if ($file->isFile() && $file->getExtension() === 'php') {
$config = str_replace($configPath.DIRECTORY_SEPARATOR, '', $file->getPathname());
$config_key = str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $config);
$segments = explode('.', $this->nameLower.'.'.$config_key);
// Remove duplicated adjacent segments
$normalized = [];
foreach ($segments as $segment) {
if (end($normalized) !== $segment) {
$normalized[] = $segment;
}
}
$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);
$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}
/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;
config([$key => array_replace_recursive($existing, $module_config)]);
}
/**
* Register views.
*/
public function registerViews(): void
{
$viewPath = resource_path('views/modules/'.$this->nameLower);
$sourcePath = module_path($this->name, '$PATH_VIEWS$');
$this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower);
Blade::componentNamespace(config('modules.namespace').'\\' . $this->name . '\\View\\Components', $this->nameLower);
}
/**
* Get the services provided by the provider.
*/
public function provides(): array
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (config('view.paths') as $path) {
if (is_dir($path.'/modules/'.$this->nameLower)) {
$paths[] = $path.'/modules/'.$this->nameLower;
}
}
return $paths;
}
}

@ -1,15 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
class $CLASS$ implements Scope
{
/**
* Apply the scope to a given Eloquent query builder.
*/
public function apply(Builder $builder, Model $model): void {}
}

@ -1,16 +0,0 @@
<?php
namespace $NAMESPACE$;
use Illuminate\Database\Seeder;
class $NAME$ extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

@ -1,8 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
class $CLASS$
{
public function __invoke() {}
}

@ -1,8 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
class $CLASS$
{
public function handle() {}
}

@ -1,18 +0,0 @@
<?php
namespace $NAMESPACE$;
use Tests\TestCase;
class $CLASS$ extends TestCase
{
/**
* A basic test example.
*/
public function test_the_application_returns_a_successful_response(): void
{
$response = $this->get('/');
$response->assertStatus(200);
}
}

@ -1,16 +0,0 @@
<?php
namespace $NAMESPACE$;
use Tests\TestCase;
class $CLASS$ extends TestCase
{
/**
* A basic test example.
*/
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}
}

@ -1,5 +0,0 @@
<?php
namespace $CLASS_NAMESPACE$;
trait $CLASS$ {}

@ -1,3 +0,0 @@
<div>
<!-- $QUOTE$ -->
</div>

@ -1,5 +0,0 @@
<x-$LOWER_NAME$::layouts.master>
<h1>Hello World</h1>
<p>Module: {!! config('$LOWER_NAME$.name') !!}</p>
</x-$LOWER_NAME$::layouts.master>

@ -1,29 +0,0 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>$STUDLY_NAME$ Module - {{ config('app.name', 'Laravel') }}</title>
<meta name="description" content="{{ $description ?? '' }}">
<meta name="keywords" content="{{ $keywords ?? '' }}">
<meta name="author" content="{{ $author ?? '' }}">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
{{-- Vite CSS --}}
{{-- {{ module_vite('build-$LOWER_NAME$', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
{{ $slot }}
{{-- Vite JS --}}
{{-- {{ module_vite('build-$LOWER_NAME$', 'resources/assets/js/app.js') }} --}}
</body>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save