refactor: adopt new helpers in laravel 9

This commit is contained in:
HDVinnie
2022-03-06 17:20:05 -05:00
parent 44e5681671
commit 594b7864d9
89 changed files with 465 additions and 470 deletions
+5 -5
View File
@@ -32,7 +32,7 @@ class FollowController extends Controller
$user = User::where('username', '=', $username)->firstOrFail();
if ($request->user()->id == $user->id) {
return \redirect()->route('users.show', ['username' => $user->username])
return \to_route('users.show', ['username' => $user->username])
->withErrors(\trans('user.follow-yourself'));
}
@@ -45,11 +45,11 @@ class FollowController extends Controller
$user->notify(new NewFollow('user', $request->user(), $user, $follow));
}
return \redirect()->route('users.show', ['username' => $user->username])
return \to_route('users.show', ['username' => $user->username])
->withSuccess(\sprintf(\trans('user.follow-user'), $user->username));
}
return \redirect()->route('users.show', ['username' => $user->username])
return \to_route('users.show', ['username' => $user->username])
->withErrors(\trans('user.follow-already'));
}
@@ -67,11 +67,11 @@ class FollowController extends Controller
$user->notify(new NewUnfollow('user', $request->user(), $user, $follow));
}
return \redirect()->route('users.show', ['username' => $user->username])
return \to_route('users.show', ['username' => $user->username])
->withSuccess(\sprintf(\trans('user.follow-revoked'), $user->username));
}
return \redirect()->route('users.show', ['username' => $user->username])
return \to_route('users.show', ['username' => $user->username])
->withErrors(\trans('user.follow-not-to-begin-with'));
}
}