Skip to content

Commit 5f537ed

Browse files
committed
refactor: dynamically redirect based on route prefix in profile update
1 parent 33c2d4f commit 5f537ed

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/Http/Controllers/Settings/ProfileController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ public function update(ProfileUpdateRequest $request): RedirectResponse
3737

3838
$request->user()->save();
3939

40-
return to_route('profile.edit');
40+
// Dynamically redirect based on the current route prefix
41+
$currentRouteName = $request->route()->getName();
42+
$routePrefix = str_starts_with($currentRouteName, 'admin.') ? 'admin.' : 'customer.';
43+
44+
return to_route($routePrefix . 'profile.edit');
4145
}
4246

4347
/**

0 commit comments

Comments
 (0)