From c5d36b310f40e78867e91c48bbbebefb420e8de4 Mon Sep 17 00:00:00 2001 From: roble Date: Sat, 25 Apr 2026 21:58:10 +0100 Subject: [PATCH 1/5] refactor: standardize module naming and update related configurations --- .github/workflows/test.yml | 2 +- CLAUDE.md | 2 +- Taskfile.yml | 4 +- app/Providers/RouteServiceProvider.php | 17 ------- app/Providers/SettingsServiceProvider.php | 16 ------- composer.json | 13 ++++-- module.json | 15 ------ routes/api.php | 6 ++- routes/navigation.php | 8 ++-- routes/web.php | 46 ++++++++++--------- .../Filament/Pages/GeneralSettings.php | 0 {app => src}/Filament/SettingsPlugin.php | 0 .../Http/Controllers/PasswordController.php | 0 .../Http/Controllers/ProfileController.php | 0 .../Http/Controllers/SettingsController.php | 0 .../Http/Requests/UpdatePasswordRequest.php | 0 .../Requests/UpdateProfileAvatarRequest.php | 0 .../Requests/UpdateProfileInfoRequest.php | 0 src/Providers/SettingsServiceProvider.php | 9 ++++ 19 files changed, 54 insertions(+), 84 deletions(-) delete mode 100644 app/Providers/RouteServiceProvider.php delete mode 100644 app/Providers/SettingsServiceProvider.php delete mode 100644 module.json rename {app => src}/Filament/Pages/GeneralSettings.php (100%) rename {app => src}/Filament/SettingsPlugin.php (100%) rename {app => src}/Http/Controllers/PasswordController.php (100%) rename {app => src}/Http/Controllers/ProfileController.php (100%) rename {app => src}/Http/Controllers/SettingsController.php (100%) rename {app => src}/Http/Requests/UpdatePasswordRequest.php (100%) rename {app => src}/Http/Requests/UpdateProfileAvatarRequest.php (100%) rename {app => src}/Http/Requests/UpdateProfileInfoRequest.php (100%) create mode 100644 src/Providers/SettingsServiceProvider.php diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9556bbe..3ef1b93 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,5 +13,5 @@ jobs: test: uses: saucebase-dev/saucebase/.github/workflows/test-module.yml@main with: - module: Settings + module: settings dependencies: saucebase/auth diff --git a/CLAUDE.md b/CLAUDE.md index 6736216..6c2141c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -64,7 +64,7 @@ Other modules can add items to the `settings` group from their own `routes/navig ```bash php artisan test --testsuite=Modules --filter='^Modules\\Settings\\Tests' # PHPUnit -npx playwright test --project="@Settings*" # E2E +npx playwright test --project="@settings*" # E2E ``` E2E tests in `tests/e2e/index.spec.ts` — basic settings page accessibility. diff --git a/Taskfile.yml b/Taskfile.yml index 2b055b0..5e40dde 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -9,11 +9,11 @@ tasks: test:e2e: desc: Run E2E tests for Settings module - cmd: npx playwright test --project="@Settings*" {{.CLI_ARGS}} + cmd: npx playwright test --project="@settings*" {{.CLI_ARGS}} interactive: true # ── Code Generation ──────────────────────────────────────────── types:generate: desc: Generate TypeScript types from PHP DTOs and enums - cmd: php artisan module:generate-types Settings + cmd: php artisan module:generate-types settings diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php deleted file mode 100644 index 172946d..0000000 --- a/app/Providers/RouteServiceProvider.php +++ /dev/null @@ -1,17 +0,0 @@ -group(module_path('settings', '/routes/web.php')); - Route::middleware('api') - ->group(module_path('settings', '/routes/api.php')); - } -} diff --git a/app/Providers/SettingsServiceProvider.php b/app/Providers/SettingsServiceProvider.php deleted file mode 100644 index 7a91b1c..0000000 --- a/app/Providers/SettingsServiceProvider.php +++ /dev/null @@ -1,16 +0,0 @@ -prefix('api/v1/settings')->group(function () { - Route::apiResource('settings', SettingsController::class, ['as' => 'api']); +Route::middleware('api')->group(function (): void { + Route::middleware(['auth:sanctum'])->prefix('api/v1/settings')->group(function (): void { + Route::apiResource('settings', SettingsController::class, ['as' => 'api']); + }); }); diff --git a/routes/navigation.php b/routes/navigation.php index c8b4ed1..d7c76f3 100644 --- a/routes/navigation.php +++ b/routes/navigation.php @@ -14,7 +14,7 @@ */ // User menu - Settings -Navigation::add('Settings', route('settings.index'), function (Section $section) { +Navigation::add('Settings', fn () => route('settings.index'), function (Section $section) { $section->attributes([ 'group' => 'user', 'slug' => 'settings', @@ -24,7 +24,7 @@ }); // Settings sidebar - General -Navigation::add('General', route('settings.index'), function (Section $section) { +Navigation::add('General', fn () => route('settings.index'), function (Section $section) { $section->attributes([ 'group' => 'settings', 'slug' => 'settings', @@ -34,7 +34,7 @@ }); // Settings sidebar - Profile -Navigation::add('Profile', route('settings.profile'), function (Section $section) { +Navigation::add('Profile', fn () => route('settings.profile'), function (Section $section) { $section->attributes([ 'group' => 'settings', 'slug' => 'profile', @@ -44,7 +44,7 @@ }); // Secondary navigation - Settings -Navigation::add('Settings', route('settings.index'), function (Section $section) { +Navigation::add('Settings', fn () => route('settings.index'), function (Section $section) { $section->attributes([ 'group' => 'secondary', 'slug' => 'settings', diff --git a/routes/web.php b/routes/web.php index 5576950..a37da73 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,34 +5,36 @@ use Modules\Settings\Http\Controllers\ProfileController; use Modules\Settings\Http\Controllers\SettingsController; -Route::group(['middleware' => [ - 'auth', - 'verified', - 'role:admin|user', -]], function () { - Route::prefix('settings')->group(function () { - Route::get('/', [SettingsController::class, 'index']) - ->name('settings.index'); +Route::middleware('web')->group(function (): void { + Route::group(['middleware' => [ + 'auth', + 'verified', + 'role:admin|user', + ]], function (): void { + Route::prefix('settings')->group(function (): void { + Route::get('/', [SettingsController::class, 'index']) + ->name('settings.index'); - Route::get('profile', [ProfileController::class, 'show']) - ->name('settings.profile'); + Route::get('profile', [ProfileController::class, 'show']) + ->name('settings.profile'); - Route::get('profile/edit', [ProfileController::class, 'edit']) - ->name('settings.profile.edit'); + Route::get('profile/edit', [ProfileController::class, 'edit']) + ->name('settings.profile.edit'); - Route::patch('profile/info', [ProfileController::class, 'updateInfo']) - ->name('settings.profile.update-info'); + Route::patch('profile/info', [ProfileController::class, 'updateInfo']) + ->name('settings.profile.update-info'); - Route::post('profile/avatar', [ProfileController::class, 'updateAvatar']) - ->name('settings.profile.update-avatar'); + Route::post('profile/avatar', [ProfileController::class, 'updateAvatar']) + ->name('settings.profile.update-avatar'); - Route::delete('profile/avatar', [ProfileController::class, 'deleteAvatar']) - ->name('settings.profile.delete-avatar'); + Route::delete('profile/avatar', [ProfileController::class, 'deleteAvatar']) + ->name('settings.profile.delete-avatar'); - Route::get('profile/password', [PasswordController::class, 'edit']) - ->name('settings.profile.password.edit'); + Route::get('profile/password', [PasswordController::class, 'edit']) + ->name('settings.profile.password.edit'); - Route::put('profile/password', [PasswordController::class, 'update']) - ->name('settings.profile.password.update'); + Route::put('profile/password', [PasswordController::class, 'update']) + ->name('settings.profile.password.update'); + }); }); }); diff --git a/app/Filament/Pages/GeneralSettings.php b/src/Filament/Pages/GeneralSettings.php similarity index 100% rename from app/Filament/Pages/GeneralSettings.php rename to src/Filament/Pages/GeneralSettings.php diff --git a/app/Filament/SettingsPlugin.php b/src/Filament/SettingsPlugin.php similarity index 100% rename from app/Filament/SettingsPlugin.php rename to src/Filament/SettingsPlugin.php diff --git a/app/Http/Controllers/PasswordController.php b/src/Http/Controllers/PasswordController.php similarity index 100% rename from app/Http/Controllers/PasswordController.php rename to src/Http/Controllers/PasswordController.php diff --git a/app/Http/Controllers/ProfileController.php b/src/Http/Controllers/ProfileController.php similarity index 100% rename from app/Http/Controllers/ProfileController.php rename to src/Http/Controllers/ProfileController.php diff --git a/app/Http/Controllers/SettingsController.php b/src/Http/Controllers/SettingsController.php similarity index 100% rename from app/Http/Controllers/SettingsController.php rename to src/Http/Controllers/SettingsController.php diff --git a/app/Http/Requests/UpdatePasswordRequest.php b/src/Http/Requests/UpdatePasswordRequest.php similarity index 100% rename from app/Http/Requests/UpdatePasswordRequest.php rename to src/Http/Requests/UpdatePasswordRequest.php diff --git a/app/Http/Requests/UpdateProfileAvatarRequest.php b/src/Http/Requests/UpdateProfileAvatarRequest.php similarity index 100% rename from app/Http/Requests/UpdateProfileAvatarRequest.php rename to src/Http/Requests/UpdateProfileAvatarRequest.php diff --git a/app/Http/Requests/UpdateProfileInfoRequest.php b/src/Http/Requests/UpdateProfileInfoRequest.php similarity index 100% rename from app/Http/Requests/UpdateProfileInfoRequest.php rename to src/Http/Requests/UpdateProfileInfoRequest.php diff --git a/src/Providers/SettingsServiceProvider.php b/src/Providers/SettingsServiceProvider.php new file mode 100644 index 0000000..62ff7d3 --- /dev/null +++ b/src/Providers/SettingsServiceProvider.php @@ -0,0 +1,9 @@ + Date: Tue, 28 Apr 2026 20:48:27 +0100 Subject: [PATCH 2/5] feat: add getNavigationGroupSort method to SettingsPlugin --- src/Filament/SettingsPlugin.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Filament/SettingsPlugin.php b/src/Filament/SettingsPlugin.php index 9c4d139..fba3ce3 100644 --- a/src/Filament/SettingsPlugin.php +++ b/src/Filament/SettingsPlugin.php @@ -22,6 +22,11 @@ public function getId(): string return 'settings'; } + public static function getNavigationGroupSort(): int + { + return 3; + } + public function boot(Panel $panel): void { $panel->navigationGroups([ From e7974d262d49492d2bd53728483dc2f5f201192f Mon Sep 17 00:00:00 2001 From: roble Date: Wed, 29 Apr 2026 21:36:35 +0100 Subject: [PATCH 3/5] feat: add db:seed task to seed the Settings module database --- Taskfile.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Taskfile.yml b/Taskfile.yml index 5e40dde..80a3017 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -12,6 +12,12 @@ tasks: cmd: npx playwright test --project="@settings*" {{.CLI_ARGS}} interactive: true + # ── Database ────────────────────────────────────────────────── + + db:seed: + desc: Seed the Settings module database + cmd: php artisan modules:seed --module=settings + # ── Code Generation ──────────────────────────────────────────── types:generate: From 2dd80794b57de3b4172743db592e5063c307ea22 Mon Sep 17 00:00:00 2001 From: roble Date: Fri, 22 May 2026 21:33:50 +0100 Subject: [PATCH 4/5] feat: implement Settings module with profile and password management components --- resources/js/app.ts | 27 +------------------ resources/js/vue/app.ts | 26 ++++++++++++++++++ .../js/{ => vue}/components/PageHeader.vue | 0 resources/js/{ => vue}/pages/Index.vue | 0 resources/js/{ => vue}/pages/Profile.vue | 0 .../pages/Profile/ChangePassword.vue | 0 resources/js/{ => vue}/pages/Profile/Edit.vue | 0 7 files changed, 27 insertions(+), 26 deletions(-) create mode 100644 resources/js/vue/app.ts rename resources/js/{ => vue}/components/PageHeader.vue (100%) rename resources/js/{ => vue}/pages/Index.vue (100%) rename resources/js/{ => vue}/pages/Profile.vue (100%) rename resources/js/{ => vue}/pages/Profile/ChangePassword.vue (100%) rename resources/js/{ => vue}/pages/Profile/Edit.vue (100%) diff --git a/resources/js/app.ts b/resources/js/app.ts index 70a0aaf..3043f15 100644 --- a/resources/js/app.ts +++ b/resources/js/app.ts @@ -1,26 +1 @@ -import { registerIcon } from '@/lib/navigation'; -import IconSettings from '~icons/lucide/settings'; -import IconUserCircle from '~icons/lucide/user-circle'; - -import '../css/style.css'; - -/** - * Settings module setup - * Called during app initialization before mounting - * - * NOTE: Navigation registration has been moved to backend SettingsServiceProvider. - */ -export function setup() { - console.debug('Settings module loaded'); - - registerIcon('settings', IconSettings); - registerIcon('profile', IconUserCircle); -} - -/** - * Settings module after mount logic - * Called after the app has been mounted - */ -export function afterMount(/* app: App */) { - console.debug('Settings module after mount logic executed'); -} +export * from './vue/app'; diff --git a/resources/js/vue/app.ts b/resources/js/vue/app.ts new file mode 100644 index 0000000..06a4323 --- /dev/null +++ b/resources/js/vue/app.ts @@ -0,0 +1,26 @@ +import { registerIcon } from '@/lib/navigation'; +import IconSettings from '~icons/lucide/settings'; +import IconUserCircle from '~icons/lucide/user-circle'; + +import '@modules/settings/resources/css/style.css'; + +/** + * Settings module setup + * Called during app initialization before mounting + * + * NOTE: Navigation registration has been moved to backend SettingsServiceProvider. + */ +export function setup() { + console.debug('Settings module loaded'); + + registerIcon('settings', IconSettings); + registerIcon('profile', IconUserCircle); +} + +/** + * Settings module after mount logic + * Called after the app has been mounted + */ +export function afterMount(/* app: App */) { + console.debug('Settings module after mount logic executed'); +} diff --git a/resources/js/components/PageHeader.vue b/resources/js/vue/components/PageHeader.vue similarity index 100% rename from resources/js/components/PageHeader.vue rename to resources/js/vue/components/PageHeader.vue diff --git a/resources/js/pages/Index.vue b/resources/js/vue/pages/Index.vue similarity index 100% rename from resources/js/pages/Index.vue rename to resources/js/vue/pages/Index.vue diff --git a/resources/js/pages/Profile.vue b/resources/js/vue/pages/Profile.vue similarity index 100% rename from resources/js/pages/Profile.vue rename to resources/js/vue/pages/Profile.vue diff --git a/resources/js/pages/Profile/ChangePassword.vue b/resources/js/vue/pages/Profile/ChangePassword.vue similarity index 100% rename from resources/js/pages/Profile/ChangePassword.vue rename to resources/js/vue/pages/Profile/ChangePassword.vue diff --git a/resources/js/pages/Profile/Edit.vue b/resources/js/vue/pages/Profile/Edit.vue similarity index 100% rename from resources/js/pages/Profile/Edit.vue rename to resources/js/vue/pages/Profile/Edit.vue From c7f6e93ff81b920fe57f466c86ffc7c2374b5f1a Mon Sep 17 00:00:00 2001 From: roble Date: Tue, 2 Jun 2026 20:05:18 +0100 Subject: [PATCH 5/5] fix: update copyright year in LICENSE file to 2026 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index f9a509b..cf78a69 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Saucebase +Copyright (c) 2026 Saucebase Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal