diff --git a/src/Http/Controllers/EmailVerificationNotificationController.php b/src/Http/Controllers/EmailVerificationNotificationController.php index aa8d4ac8..ec9e9034 100644 --- a/src/Http/Controllers/EmailVerificationNotificationController.php +++ b/src/Http/Controllers/EmailVerificationNotificationController.php @@ -2,8 +2,8 @@ namespace Laravel\Fortify\Http\Controllers; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -use Illuminate\Http\Response; use Illuminate\Routing\Controller; class EmailVerificationNotificationController extends Controller @@ -18,14 +18,14 @@ public function store(Request $request) { if ($request->user()->hasVerifiedEmail()) { return $request->wantsJson() - ? new Response('', 204) + ? new JsonResponse('', 204) : redirect(config('fortify.home')); } $request->user()->sendEmailVerificationNotification(); return $request->wantsJson() - ? new Response('', 202) + ? new JsonResponse('', 202) : back()->with('status', 'verification-link-sent'); } } diff --git a/src/Http/Controllers/PasswordController.php b/src/Http/Controllers/PasswordController.php index ea5adee2..e8ffb12b 100644 --- a/src/Http/Controllers/PasswordController.php +++ b/src/Http/Controllers/PasswordController.php @@ -2,8 +2,8 @@ namespace Laravel\Fortify\Http\Controllers; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -use Illuminate\Http\Response; use Illuminate\Routing\Controller; use Laravel\Fortify\Contracts\UpdatesUserPasswords; @@ -21,7 +21,7 @@ public function update(Request $request, UpdatesUserPasswords $updater) $updater->update($request->user(), $request->all()); return $request->wantsJson() - ? new Response('', 200) + ? new JsonResponse('', 200) : back()->with('status', 'password-updated'); } } diff --git a/src/Http/Controllers/ProfileInformationController.php b/src/Http/Controllers/ProfileInformationController.php index be4c4631..90795b71 100644 --- a/src/Http/Controllers/ProfileInformationController.php +++ b/src/Http/Controllers/ProfileInformationController.php @@ -2,8 +2,8 @@ namespace Laravel\Fortify\Http\Controllers; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; -use Illuminate\Http\Response; use Illuminate\Routing\Controller; use Laravel\Fortify\Contracts\UpdatesUserProfileInformation; @@ -22,7 +22,7 @@ public function update(Request $request, $updater->update($request->user(), $request->all()); return $request->wantsJson() - ? new Response('', 200) + ? new JsonResponse('', 200) : back()->with('status', 'profile-information-updated'); } } diff --git a/src/Http/Controllers/RecoveryCodeController.php b/src/Http/Controllers/RecoveryCodeController.php index f6cca06b..8fda352a 100644 --- a/src/Http/Controllers/RecoveryCodeController.php +++ b/src/Http/Controllers/RecoveryCodeController.php @@ -2,6 +2,7 @@ namespace Laravel\Fortify\Http\Controllers; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Routing\Controller; use Laravel\Fortify\Actions\GenerateNewRecoveryCodes; @@ -38,7 +39,7 @@ public function store(Request $request, GenerateNewRecoveryCodes $generate) $generate($request->user()); return $request->wantsJson() - ? response('', 200) + ? new JsonResponse('', 200) : back()->with('status', 'recovery-codes-generated'); } } diff --git a/src/Http/Controllers/TwoFactorAuthenticationController.php b/src/Http/Controllers/TwoFactorAuthenticationController.php index a1f434e6..23809083 100644 --- a/src/Http/Controllers/TwoFactorAuthenticationController.php +++ b/src/Http/Controllers/TwoFactorAuthenticationController.php @@ -2,6 +2,7 @@ namespace Laravel\Fortify\Http\Controllers; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Routing\Controller; use Laravel\Fortify\Actions\DisableTwoFactorAuthentication; @@ -21,7 +22,7 @@ public function store(Request $request, EnableTwoFactorAuthentication $enable) $enable($request->user()); return $request->wantsJson() - ? response('', 200) + ? new JsonResponse('', 200) : back()->with('status', 'two-factor-authentication-enabled'); } @@ -37,7 +38,7 @@ public function destroy(Request $request, DisableTwoFactorAuthentication $disabl $disable($request->user()); return $request->wantsJson() - ? response('', 200) + ? new JsonResponse('', 200) : back()->with('status', 'two-factor-authentication-disabled'); } } diff --git a/src/Http/Responses/LogoutResponse.php b/src/Http/Responses/LogoutResponse.php index 23e59e5f..abe7128a 100644 --- a/src/Http/Responses/LogoutResponse.php +++ b/src/Http/Responses/LogoutResponse.php @@ -2,6 +2,7 @@ namespace Laravel\Fortify\Http\Responses; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Response; use Laravel\Fortify\Contracts\LogoutResponse as LogoutResponseContract; @@ -16,7 +17,7 @@ class LogoutResponse implements LogoutResponseContract public function toResponse($request) { return $request->wantsJson() - ? new Response('', 204) + ? new JsonResponse('', 204) : redirect('/'); } } diff --git a/src/Http/Responses/PasswordConfirmedResponse.php b/src/Http/Responses/PasswordConfirmedResponse.php index c51bec93..6dc7653b 100644 --- a/src/Http/Responses/PasswordConfirmedResponse.php +++ b/src/Http/Responses/PasswordConfirmedResponse.php @@ -2,6 +2,7 @@ namespace Laravel\Fortify\Http\Responses; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Response; use Laravel\Fortify\Contracts\PasswordConfirmedResponse as PasswordConfirmedResponseContract; @@ -16,7 +17,7 @@ class PasswordConfirmedResponse implements PasswordConfirmedResponseContract public function toResponse($request) { return $request->wantsJson() - ? new Response('', 201) + ? new JsonResponse('', 201) : redirect()->intended(config('fortify.home')); } } diff --git a/src/Http/Responses/RegisterResponse.php b/src/Http/Responses/RegisterResponse.php index e8920921..3091d95e 100644 --- a/src/Http/Responses/RegisterResponse.php +++ b/src/Http/Responses/RegisterResponse.php @@ -2,6 +2,7 @@ namespace Laravel\Fortify\Http\Responses; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Response; use Laravel\Fortify\Contracts\RegisterResponse as RegisterResponseContract; @@ -16,7 +17,7 @@ class RegisterResponse implements RegisterResponseContract public function toResponse($request) { return $request->wantsJson() - ? new Response('', 201) + ? new JsonResponse('', 201) : redirect(config('fortify.home')); } } diff --git a/src/Http/Responses/TwoFactorLoginResponse.php b/src/Http/Responses/TwoFactorLoginResponse.php index 694c9e1a..816008aa 100644 --- a/src/Http/Responses/TwoFactorLoginResponse.php +++ b/src/Http/Responses/TwoFactorLoginResponse.php @@ -2,6 +2,7 @@ namespace Laravel\Fortify\Http\Responses; +use Illuminate\Http\JsonResponse; use Laravel\Fortify\Contracts\TwoFactorLoginResponse as TwoFactorLoginResponseContract; class TwoFactorLoginResponse implements TwoFactorLoginResponseContract @@ -15,7 +16,7 @@ class TwoFactorLoginResponse implements TwoFactorLoginResponseContract public function toResponse($request) { return $request->wantsJson() - ? response('', 204) + ? new JsonResponse('', 204) : redirect(config('fortify.home')); } }