Skip to content
This repository was archived by the owner on Sep 5, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions routes/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

// User menu - Settings
Navigation::add('Settings', fn () => route('settings.index'), function (Section $section) {
Navigation::add('Settings', fn () => route('settings.profile'), function (Section $section) {
$section->attributes([
'group' => 'user',
'slug' => 'settings',
Expand All @@ -23,36 +23,12 @@
]);
});

// Settings sidebar - General
Navigation::add('General', fn () => route('settings.index'), function (Section $section) {
$section->attributes([
'group' => 'settings',
'slug' => 'settings',
'icon' => 'settings',
'order' => 10,
]);
});

// Settings sidebar - Profile
Navigation::add('Profile', fn () => route('settings.profile'), function (Section $section) {
$section->attributes([
'group' => 'settings',
'slug' => 'profile',
'icon' => 'profile',
'order' => 20,
]);
});

// Secondary navigation - Settings
Navigation::add('Settings', fn () => route('settings.index'), function (Section $section) {
$section->attributes([
'group' => 'secondary',
'slug' => 'settings',
'icon' => 'settings',
'order' => 10,
'badge' => [
'content' => '1',
'variant' => 'destructive',
],
]);
});
3 changes: 1 addition & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use Illuminate\Support\Facades\Route;
use Modules\Settings\Http\Controllers\PasswordController;
use Modules\Settings\Http\Controllers\ProfileController;
use Modules\Settings\Http\Controllers\SettingsController;

Route::middleware('web')->group(function (): void {
Route::group(['middleware' => [
Expand All @@ -12,7 +11,7 @@
'role:admin|user',
]], function (): void {
Route::prefix('settings')->group(function (): void {
Route::get('/', [SettingsController::class, 'index'])
Route::redirect('/', '/settings/profile')
->name('settings.index');

Route::get('profile', [ProfileController::class, 'show'])
Expand Down
42 changes: 0 additions & 42 deletions src/Filament/Pages/GeneralSettings.php

This file was deleted.

39 changes: 0 additions & 39 deletions src/Filament/SettingsPlugin.php

This file was deleted.

18 changes: 0 additions & 18 deletions tests/Feature/ExampleTest.php

This file was deleted.

42 changes: 42 additions & 0 deletions tests/Feature/SettingsNavigationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Modules\Settings\Tests\Feature;

use App\Filament\Admin\Pages\GeneralSettings;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Route;
use Tests\TestCase;

class SettingsNavigationTest extends TestCase
{
use RefreshDatabase;

public function test_settings_index_redirects_authenticated_user_to_profile(): void
{
$user = $this->createUser();

$response = $this->actingAs($user)->get(route('settings.index'));

$response->assertRedirectToRoute('settings.profile');
}

public function test_settings_navigation_only_contains_profile(): void
{
$user = $this->createUser();

$response = $this->actingAs($user)->get(route('settings.profile'));

$this->assertSame(
['Profile'],
array_column($response->inertiaProps('navigation.settings'), 'title'),
);
}

public function test_admin_general_settings_route_uses_core_settings_page(): void
{
$route = Route::getRoutes()->getByName('filament.admin.pages.general-settings');

$this->assertNotNull($route);
$this->assertSame(GeneralSettings::class, $route->getActionName());
}
}