diff --git a/resources/js/components/app-header.tsx b/resources/js/components/app-header.tsx
index d151697c4..ababef263 100644
--- a/resources/js/components/app-header.tsx
+++ b/resources/js/components/app-header.tsx
@@ -18,7 +18,7 @@ import AppLogoIcon from './app-logo-icon';
const mainNavItems: NavItem[] = [
{
title: 'Dashboard',
- url: '/dashboard',
+ url: route('dashboard'),
icon: LayoutGrid,
},
];
@@ -94,7 +94,7 @@ export function AppHeader({ breadcrumbs = [] }: AppHeaderProps) {
-
+
diff --git a/resources/js/components/app-sidebar.tsx b/resources/js/components/app-sidebar.tsx
index cd00fbdcc..390108dcf 100644
--- a/resources/js/components/app-sidebar.tsx
+++ b/resources/js/components/app-sidebar.tsx
@@ -10,7 +10,7 @@ import AppLogo from './app-logo';
const mainNavItems: NavItem[] = [
{
title: 'Dashboard',
- url: '/dashboard',
+ url: route('dashboard'),
icon: LayoutGrid,
},
];
@@ -35,7 +35,7 @@ export function AppSidebar() {
-
+
diff --git a/resources/js/layouts/settings/layout.tsx b/resources/js/layouts/settings/layout.tsx
index 2a50de967..21585576d 100644
--- a/resources/js/layouts/settings/layout.tsx
+++ b/resources/js/layouts/settings/layout.tsx
@@ -8,17 +8,17 @@ import { Link } from '@inertiajs/react';
const sidebarNavItems: NavItem[] = [
{
title: 'Profile',
- url: '/settings/profile',
+ url: route('profile.edit'),
icon: null,
},
{
title: 'Password',
- url: '/settings/password',
+ url: route('password.edit'),
icon: null,
},
{
title: 'Appearance',
- url: '/settings/appearance',
+ url: route('appearance'),
icon: null,
},
];
diff --git a/resources/js/pages/dashboard.tsx b/resources/js/pages/dashboard.tsx
index 53baa94e8..431a5bf3b 100644
--- a/resources/js/pages/dashboard.tsx
+++ b/resources/js/pages/dashboard.tsx
@@ -6,7 +6,7 @@ import { Head } from '@inertiajs/react';
const breadcrumbs: BreadcrumbItem[] = [
{
title: 'Dashboard',
- href: '/dashboard',
+ href: route('dashboard'),
},
];
diff --git a/routes/auth.php b/routes/auth.php
index 7862ed46c..6dce5314b 100644
--- a/routes/auth.php
+++ b/routes/auth.php
@@ -14,7 +14,8 @@
Route::get('register', [RegisteredUserController::class, 'create'])
->name('register');
- Route::post('register', [RegisteredUserController::class, 'store']);
+ Route::post('register', [RegisteredUserController::class, 'store'])
+ ->name('register.store');
Route::get('login', [AuthenticatedSessionController::class, 'create'])
->name('login');
@@ -49,7 +50,8 @@
Route::get('confirm-password', [ConfirmablePasswordController::class, 'show'])
->name('password.confirm');
- Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']);
+ Route::post('confirm-password', [ConfirmablePasswordController::class, 'store'])
+ ->name('password.confirmation');
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])
->name('logout');
diff --git a/tests/Feature/Auth/AuthenticationTest.php b/tests/Feature/Auth/AuthenticationTest.php
index c59d166a8..3c39e6bac 100644
--- a/tests/Feature/Auth/AuthenticationTest.php
+++ b/tests/Feature/Auth/AuthenticationTest.php
@@ -12,7 +12,7 @@ class AuthenticationTest extends TestCase
public function test_login_screen_can_be_rendered()
{
- $response = $this->get('/login');
+ $response = $this->get(route('login'));
$response->assertStatus(200);
}
@@ -21,7 +21,7 @@ public function test_users_can_authenticate_using_the_login_screen()
{
$user = User::factory()->create();
- $response = $this->post('/login', [
+ $response = $this->post(route('login'), [
'email' => $user->email,
'password' => 'password',
]);
@@ -34,7 +34,7 @@ public function test_users_can_not_authenticate_with_invalid_password()
{
$user = User::factory()->create();
- $this->post('/login', [
+ $this->post(route('login'), [
'email' => $user->email,
'password' => 'wrong-password',
]);
@@ -46,7 +46,7 @@ public function test_users_can_logout()
{
$user = User::factory()->create();
- $response = $this->actingAs($user)->post('/logout');
+ $response = $this->actingAs($user)->post(route('logout'));
$this->assertGuest();
$response->assertRedirect('/');
diff --git a/tests/Feature/Auth/EmailVerificationTest.php b/tests/Feature/Auth/EmailVerificationTest.php
index 627fe709d..f1736ad1d 100644
--- a/tests/Feature/Auth/EmailVerificationTest.php
+++ b/tests/Feature/Auth/EmailVerificationTest.php
@@ -17,7 +17,7 @@ public function test_email_verification_screen_can_be_rendered()
{
$user = User::factory()->unverified()->create();
- $response = $this->actingAs($user)->get('/verify-email');
+ $response = $this->actingAs($user)->get(route('verification.notice'));
$response->assertStatus(200);
}
diff --git a/tests/Feature/Auth/PasswordConfirmationTest.php b/tests/Feature/Auth/PasswordConfirmationTest.php
index d2072ffd4..5743b7b37 100644
--- a/tests/Feature/Auth/PasswordConfirmationTest.php
+++ b/tests/Feature/Auth/PasswordConfirmationTest.php
@@ -14,7 +14,7 @@ public function test_confirm_password_screen_can_be_rendered()
{
$user = User::factory()->create();
- $response = $this->actingAs($user)->get('/confirm-password');
+ $response = $this->actingAs($user)->get(route('password.confirm'));
$response->assertStatus(200);
}
@@ -23,7 +23,7 @@ public function test_password_can_be_confirmed()
{
$user = User::factory()->create();
- $response = $this->actingAs($user)->post('/confirm-password', [
+ $response = $this->actingAs($user)->post(route('password.confirmation'), [
'password' => 'password',
]);
@@ -35,7 +35,7 @@ public function test_password_is_not_confirmed_with_invalid_password()
{
$user = User::factory()->create();
- $response = $this->actingAs($user)->post('/confirm-password', [
+ $response = $this->actingAs($user)->post(route('password.confirmation'), [
'password' => 'wrong-password',
]);
diff --git a/tests/Feature/Auth/PasswordResetTest.php b/tests/Feature/Auth/PasswordResetTest.php
index 3c7441f78..a7120a5f2 100644
--- a/tests/Feature/Auth/PasswordResetTest.php
+++ b/tests/Feature/Auth/PasswordResetTest.php
@@ -14,7 +14,7 @@ class PasswordResetTest extends TestCase
public function test_reset_password_link_screen_can_be_rendered()
{
- $response = $this->get('/forgot-password');
+ $response = $this->get(route('password.request'));
$response->assertStatus(200);
}
@@ -25,7 +25,7 @@ public function test_reset_password_link_can_be_requested()
$user = User::factory()->create();
- $this->post('/forgot-password', ['email' => $user->email]);
+ $this->post(route('password.email'), ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class);
}
@@ -36,7 +36,7 @@ public function test_reset_password_screen_can_be_rendered()
$user = User::factory()->create();
- $this->post('/forgot-password', ['email' => $user->email]);
+ $this->post(route('password.email'), ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
$response = $this->get('/reset-password/'.$notification->token);
@@ -53,10 +53,10 @@ public function test_password_can_be_reset_with_valid_token()
$user = User::factory()->create();
- $this->post('/forgot-password', ['email' => $user->email]);
+ $this->post(route('password.email'), ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) {
- $response = $this->post('/reset-password', [
+ $response = $this->post(route('password.store'), [
'token' => $notification->token,
'email' => $user->email,
'password' => 'password',
diff --git a/tests/Feature/Auth/RegistrationTest.php b/tests/Feature/Auth/RegistrationTest.php
index d0c3ea257..16cc907dc 100644
--- a/tests/Feature/Auth/RegistrationTest.php
+++ b/tests/Feature/Auth/RegistrationTest.php
@@ -11,14 +11,14 @@ class RegistrationTest extends TestCase
public function test_registration_screen_can_be_rendered()
{
- $response = $this->get('/register');
+ $response = $this->get(route('register'));
$response->assertStatus(200);
}
public function test_new_users_can_register()
{
- $response = $this->post('/register', [
+ $response = $this->post(route('register.store'), [
'name' => 'Test User',
'email' => 'test@example.com',
'password' => 'password',
diff --git a/tests/Feature/DashboardTest.php b/tests/Feature/DashboardTest.php
index 8585ade69..f37395a66 100644
--- a/tests/Feature/DashboardTest.php
+++ b/tests/Feature/DashboardTest.php
@@ -12,13 +12,13 @@ class DashboardTest extends TestCase
public function test_guests_are_redirected_to_the_login_page()
{
- $this->get('/dashboard')->assertRedirect('/login');
+ $this->get(route('dashboard'))->assertRedirect('/login');
}
public function test_authenticated_users_can_visit_the_dashboard()
{
$this->actingAs($user = User::factory()->create());
- $this->get('/dashboard')->assertOk();
+ $this->get(route('dashboard'))->assertOk();
}
}
diff --git a/tests/Feature/Settings/PasswordUpdateTest.php b/tests/Feature/Settings/PasswordUpdateTest.php
index 64e9189b3..4ffe44142 100644
--- a/tests/Feature/Settings/PasswordUpdateTest.php
+++ b/tests/Feature/Settings/PasswordUpdateTest.php
@@ -17,8 +17,8 @@ public function test_password_can_be_updated()
$response = $this
->actingAs($user)
- ->from('/settings/password')
- ->put('/settings/password', [
+ ->from(route('password.edit'))
+ ->put(route('password.update'), [
'current_password' => 'password',
'password' => 'new-password',
'password_confirmation' => 'new-password',
@@ -26,7 +26,7 @@ public function test_password_can_be_updated()
$response
->assertSessionHasNoErrors()
- ->assertRedirect('/settings/password');
+ ->assertRedirect(route('password.edit'));
$this->assertTrue(Hash::check('new-password', $user->refresh()->password));
}
@@ -37,8 +37,8 @@ public function test_correct_password_must_be_provided_to_update_password()
$response = $this
->actingAs($user)
- ->from('/settings/password')
- ->put('/settings/password', [
+ ->from(route('password.edit'))
+ ->put(route('password.update'), [
'current_password' => 'wrong-password',
'password' => 'new-password',
'password_confirmation' => 'new-password',
@@ -46,6 +46,6 @@ public function test_correct_password_must_be_provided_to_update_password()
$response
->assertSessionHasErrors('current_password')
- ->assertRedirect('/settings/password');
+ ->assertRedirect(route('password.edit'));
}
}
diff --git a/tests/Feature/Settings/ProfileUpdateTest.php b/tests/Feature/Settings/ProfileUpdateTest.php
index 7d5121441..686ce4766 100644
--- a/tests/Feature/Settings/ProfileUpdateTest.php
+++ b/tests/Feature/Settings/ProfileUpdateTest.php
@@ -27,14 +27,14 @@ public function test_profile_information_can_be_updated()
$response = $this
->actingAs($user)
- ->patch('/settings/profile', [
+ ->patch(route('profile.update'), [
'name' => 'Test User',
'email' => 'test@example.com',
]);
$response
->assertSessionHasNoErrors()
- ->assertRedirect('/settings/profile');
+ ->assertRedirect(route('profile.edit'));
$user->refresh();
@@ -49,14 +49,14 @@ public function test_email_verification_status_is_unchanged_when_the_email_addre
$response = $this
->actingAs($user)
- ->patch('/settings/profile', [
+ ->patch(route('profile.update'), [
'name' => 'Test User',
'email' => $user->email,
]);
$response
->assertSessionHasNoErrors()
- ->assertRedirect('/settings/profile');
+ ->assertRedirect(route('profile.edit'));
$this->assertNotNull($user->refresh()->email_verified_at);
}
@@ -67,7 +67,7 @@ public function test_user_can_delete_their_account()
$response = $this
->actingAs($user)
- ->delete('/settings/profile', [
+ ->delete(route('profile.destroy'), [
'password' => 'password',
]);
@@ -85,14 +85,14 @@ public function test_correct_password_must_be_provided_to_delete_account()
$response = $this
->actingAs($user)
- ->from('/settings/profile')
- ->delete('/settings/profile', [
+ ->from(route('profile.edit'))
+ ->delete(route('profile.destroy'), [
'password' => 'wrong-password',
]);
$response
->assertSessionHasErrors('password')
- ->assertRedirect('/settings/profile');
+ ->assertRedirect(route('profile.edit'));
$this->assertNotNull($user->fresh());
}