diff --git a/app/Http/Controllers/Settings/ProfileController.php b/app/Http/Controllers/Settings/ProfileController.php index a6cb7e166..877a4321e 100644 --- a/app/Http/Controllers/Settings/ProfileController.php +++ b/app/Http/Controllers/Settings/ProfileController.php @@ -37,7 +37,7 @@ public function update(ProfileUpdateRequest $request): RedirectResponse $request->user()->save(); - return to_route('profile.edit'); + return to_route('settings.profile'); } /** diff --git a/resources/js/components/user-menu-content.tsx b/resources/js/components/user-menu-content.tsx index 0f198a52d..d9ed3c00d 100644 --- a/resources/js/components/user-menu-content.tsx +++ b/resources/js/components/user-menu-content.tsx @@ -2,7 +2,7 @@ import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSep import { UserInfo } from '@/components/user-info'; import { useMobileNavigation } from '@/hooks/use-mobile-navigation'; import { logout } from '@/routes'; -import { edit } from '@/routes/profile'; +import { profile } from '@/routes/settings'; import { type User } from '@/types'; import { Link, router } from '@inertiajs/react'; import { LogOut, Settings } from 'lucide-react'; @@ -29,7 +29,7 @@ export function UserMenuContent({ user }: UserMenuContentProps) { - + Settings diff --git a/resources/js/layouts/settings/layout.tsx b/resources/js/layouts/settings/layout.tsx index 14f0a861c..5690acafc 100644 --- a/resources/js/layouts/settings/layout.tsx +++ b/resources/js/layouts/settings/layout.tsx @@ -2,9 +2,7 @@ import Heading from '@/components/heading'; import { Button } from '@/components/ui/button'; import { Separator } from '@/components/ui/separator'; import { cn } from '@/lib/utils'; -import { appearance } from '@/routes'; -import { edit as editPassword } from '@/routes/password'; -import { edit } from '@/routes/profile'; +import { appearance, password, profile } from '@/routes/settings'; import { type NavItem } from '@/types'; import { Link } from '@inertiajs/react'; import { type PropsWithChildren } from 'react'; @@ -12,12 +10,12 @@ import { type PropsWithChildren } from 'react'; const sidebarNavItems: NavItem[] = [ { title: 'Profile', - href: edit(), + href: profile(), icon: null, }, { title: 'Password', - href: editPassword(), + href: password(), icon: null, }, { diff --git a/resources/js/pages/settings/appearance.tsx b/resources/js/pages/settings/appearance.tsx index 2d286a11b..f9cec6bfc 100644 --- a/resources/js/pages/settings/appearance.tsx +++ b/resources/js/pages/settings/appearance.tsx @@ -6,7 +6,7 @@ import { type BreadcrumbItem } from '@/types'; import AppLayout from '@/layouts/app-layout'; import SettingsLayout from '@/layouts/settings/layout'; -import { appearance } from '@/routes'; +import { appearance } from '@/routes/settings'; const breadcrumbs: BreadcrumbItem[] = [ { diff --git a/resources/js/pages/settings/password.tsx b/resources/js/pages/settings/password.tsx index c5045c637..55de05bad 100644 --- a/resources/js/pages/settings/password.tsx +++ b/resources/js/pages/settings/password.tsx @@ -1,22 +1,21 @@ import PasswordController from '@/actions/App/Http/Controllers/Settings/PasswordController'; +import HeadingSmall from '@/components/heading-small'; import InputError from '@/components/input-error'; +import { Button } from '@/components/ui/button'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; import AppLayout from '@/layouts/app-layout'; import SettingsLayout from '@/layouts/settings/layout'; +import { password } from '@/routes/settings'; import { type BreadcrumbItem } from '@/types'; import { Transition } from '@headlessui/react'; import { Form, Head } from '@inertiajs/react'; import { useRef } from 'react'; -import HeadingSmall from '@/components/heading-small'; -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { edit } from '@/routes/password'; - const breadcrumbs: BreadcrumbItem[] = [ { title: 'Password settings', - href: edit().url, + href: password().url, }, ]; diff --git a/resources/js/pages/settings/profile.tsx b/resources/js/pages/settings/profile.tsx index 77e5d8c79..a30988bd4 100644 --- a/resources/js/pages/settings/profile.tsx +++ b/resources/js/pages/settings/profile.tsx @@ -12,12 +12,12 @@ import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import AppLayout from '@/layouts/app-layout'; import SettingsLayout from '@/layouts/settings/layout'; -import { edit } from '@/routes/profile'; +import { profile } from '@/routes/settings'; const breadcrumbs: BreadcrumbItem[] = [ { title: 'Profile settings', - href: edit().url, + href: profile().url, }, ]; diff --git a/routes/settings.php b/routes/settings.php index 203b7cded..4374646f5 100644 --- a/routes/settings.php +++ b/routes/settings.php @@ -8,17 +8,17 @@ Route::middleware('auth')->group(function () { Route::redirect('settings', '/settings/profile'); - Route::get('settings/profile', [ProfileController::class, 'edit'])->name('profile.edit'); - Route::patch('settings/profile', [ProfileController::class, 'update'])->name('profile.update'); - Route::delete('settings/profile', [ProfileController::class, 'destroy'])->name('profile.destroy'); + Route::get('settings/profile', [ProfileController::class, 'edit'])->name('settings.profile'); + Route::patch('settings/profile', [ProfileController::class, 'update'])->name('settings.profile.update'); + Route::delete('settings/profile', [ProfileController::class, 'destroy'])->name('settings.profile.destroy'); - Route::get('settings/password', [PasswordController::class, 'edit'])->name('password.edit'); + Route::get('settings/password', [PasswordController::class, 'edit'])->name('settings.password'); Route::put('settings/password', [PasswordController::class, 'update']) ->middleware('throttle:6,1') - ->name('password.update'); + ->name('settings.password.update'); Route::get('settings/appearance', function () { return Inertia::render('settings/appearance'); - })->name('appearance'); + })->name('settings.appearance'); }); diff --git a/tests/Feature/Settings/PasswordUpdateTest.php b/tests/Feature/Settings/PasswordUpdateTest.php index c16652941..9a2a4a5ed 100644 --- a/tests/Feature/Settings/PasswordUpdateTest.php +++ b/tests/Feature/Settings/PasswordUpdateTest.php @@ -17,7 +17,7 @@ public function test_password_update_page_is_displayed() $response = $this ->actingAs($user) - ->get(route('password.edit')); + ->get(route('settings.password')); $response->assertStatus(200); } @@ -28,8 +28,8 @@ public function test_password_can_be_updated() $response = $this ->actingAs($user) - ->from(route('password.edit')) - ->put(route('password.update'), [ + ->from(route('settings.password')) + ->put(route('settings.password.update'), [ 'current_password' => 'password', 'password' => 'new-password', 'password_confirmation' => 'new-password', @@ -37,7 +37,7 @@ public function test_password_can_be_updated() $response ->assertSessionHasNoErrors() - ->assertRedirect(route('password.edit')); + ->assertRedirect(route('settings.password')); $this->assertTrue(Hash::check('new-password', $user->refresh()->password)); } @@ -48,8 +48,8 @@ public function test_correct_password_must_be_provided_to_update_password() $response = $this ->actingAs($user) - ->from(route('password.edit')) - ->put(route('password.update'), [ + ->from(route('settings.password')) + ->put(route('settings.password.update'), [ 'current_password' => 'wrong-password', 'password' => 'new-password', 'password_confirmation' => 'new-password', @@ -57,6 +57,6 @@ public function test_correct_password_must_be_provided_to_update_password() $response ->assertSessionHasErrors('current_password') - ->assertRedirect(route('password.edit')); + ->assertRedirect(route('settings.password')); } } diff --git a/tests/Feature/Settings/ProfileUpdateTest.php b/tests/Feature/Settings/ProfileUpdateTest.php index e6c95cee7..3cc0c6d8d 100644 --- a/tests/Feature/Settings/ProfileUpdateTest.php +++ b/tests/Feature/Settings/ProfileUpdateTest.php @@ -16,7 +16,7 @@ public function test_profile_page_is_displayed() $response = $this ->actingAs($user) - ->get(route('profile.edit')); + ->get(route('settings.profile')); $response->assertOk(); } @@ -27,14 +27,14 @@ public function test_profile_information_can_be_updated() $response = $this ->actingAs($user) - ->patch(route('profile.update'), [ + ->patch(route('settings.profile.update'), [ 'name' => 'Test User', 'email' => 'test@example.com', ]); $response ->assertSessionHasNoErrors() - ->assertRedirect(route('profile.edit')); + ->assertRedirect(route('settings.profile')); $user->refresh(); @@ -49,14 +49,14 @@ public function test_email_verification_status_is_unchanged_when_the_email_addre $response = $this ->actingAs($user) - ->patch(route('profile.update'), [ + ->patch(route('settings.profile.update'), [ 'name' => 'Test User', 'email' => $user->email, ]); $response ->assertSessionHasNoErrors() - ->assertRedirect(route('profile.edit')); + ->assertRedirect(route('settings.profile')); $this->assertNotNull($user->refresh()->email_verified_at); } @@ -67,7 +67,7 @@ public function test_user_can_delete_their_account() $response = $this ->actingAs($user) - ->delete(route('profile.destroy'), [ + ->delete(route('settings.profile.destroy'), [ 'password' => 'password', ]); @@ -85,14 +85,14 @@ public function test_correct_password_must_be_provided_to_delete_account() $response = $this ->actingAs($user) - ->from(route('profile.edit')) - ->delete(route('profile.destroy'), [ + ->from(route('settings.profile')) + ->delete(route('settings.profile.destroy'), [ 'password' => 'wrong-password', ]); $response ->assertSessionHasErrors('password') - ->assertRedirect(route('profile.edit')); + ->assertRedirect(route('settings.profile')); $this->assertNotNull($user->fresh()); }