@@ -346,11 +346,7 @@ public function bootstrap(): void
346
346
/** @var \Laravel\Nova\PendingRouteRegistration $routes */
347
347
$ routes = Nova::routes ();
348
348
349
- if ($ this ->withFrontendRoutes === true && $ routes ->withAuthentication === false && $ routes ->withPasswordReset === false ) {
350
- return ;
351
- }
352
-
353
- Nova::serving (function (ServingNova $ event ) {
349
+ Nova::serving (function (ServingNova $ event ) use ($ routes ) {
354
350
$ this ->sync ();
355
351
356
352
/** @var \Illuminate\Contracts\Foundation\Application $app */
@@ -359,13 +355,28 @@ public function bootstrap(): void
359
355
$ app ->scoped (StatefulGuard::class, static fn () => Auth::guard (Util::userGuard ()));
360
356
$ app ->scoped (RedirectAsIntended::class, RedirectAsIntendedForNova::class);
361
357
362
- $ app ->scoped (LoginViewResponseContract::class, LoginViewResponse::class);
363
- $ app ->scoped (LoginResponseContract::class, LoginResponse::class);
364
- $ app ->scoped (LogoutResponseContract::class, LogoutResponse::class);
365
-
366
- $ app ->scoped (ResetPasswordViewResponseContract::class, ResetPasswordViewResponse::class);
367
- $ app ->scoped (RequestPasswordResetLinkViewResponseContract::class, RequestPasswordResetLinkViewResponse::class);
368
- $ app ->scoped (ResetsUserPasswordsContract::class, ResetUserPassword::class);
358
+ if ($ routes ->withAuthentication === true ) {
359
+ $ app ->scoped (LoginViewResponseContract::class, LoginViewResponse::class);
360
+ $ app ->scoped (LoginResponseContract::class, LoginResponse::class);
361
+ $ app ->scoped (LogoutResponseContract::class, LogoutResponse::class);
362
+ $ app ->scoped (TwoFactorChallengeViewResponseContract::class, TwoFactorChallengeViewResponse::class);
363
+ $ app ->scoped (TwoFactorLoginResponseContract::class, TwoFactorLoginResponse::class);
364
+ $ app ->scoped (FortifyRedirectIfTwoFactorAuthenticatable::class, RedirectIfTwoFactorAuthenticatable::class);
365
+ }
366
+
367
+ if ($ routes ->withPasswordReset === true ) {
368
+ $ app ->scoped (ResetPasswordViewResponseContract::class, ResetPasswordViewResponse::class);
369
+ $ app ->scoped (RequestPasswordResetLinkViewResponseContract::class, RequestPasswordResetLinkViewResponse::class);
370
+ $ app ->scoped (ResetsUserPasswordsContract::class, ResetUserPassword::class);
371
+
372
+ ResetPassword::toMailUsing (static function ($ notifiable , $ token ) {
373
+ return (new MailMessage )
374
+ ->subject (Nova::__ ('Reset Password Notification ' ))
375
+ ->line (Nova::__ ('You are receiving this email because we received a password reset request for your account. ' ))
376
+ ->action (Nova::__ ('Reset Password ' ), route ('nova.pages.password.reset ' , ['token ' => $ token ]))
377
+ ->line (Nova::__ ('If you did not request a password reset, no further action is required. ' ));
378
+ });
379
+ }
369
380
370
381
$ app ->scoped (VerifyEmailViewResponseContract::class, VerifyEmailViewResponse::class);
371
382
@@ -375,19 +386,6 @@ public function bootstrap(): void
375
386
$ app ->scoped (ConfirmPasswordViewResponseContract::class, ConfirmPasswordViewResponse::class);
376
387
$ app ->scoped (PasswordConfirmedResponseContract::class, PasswordConfirmedResponse::class);
377
388
$ app ->scoped (FailedPasswordConfirmationResponseContract::class, FailedPasswordConfirmationResponse::class);
378
-
379
- $ app ->scoped (TwoFactorChallengeViewResponseContract::class, TwoFactorChallengeViewResponse::class);
380
- $ app ->scoped (TwoFactorLoginResponseContract::class, TwoFactorLoginResponse::class);
381
-
382
- $ app ->scoped (FortifyRedirectIfTwoFactorAuthenticatable::class, RedirectIfTwoFactorAuthenticatable::class);
383
-
384
- ResetPassword::toMailUsing (static function ($ notifiable , $ token ) {
385
- return (new MailMessage )
386
- ->subject (Nova::__ ('Reset Password Notification ' ))
387
- ->line (Nova::__ ('You are receiving this email because we received a password reset request for your account. ' ))
388
- ->action (Nova::__ ('Reset Password ' ), route ('nova.pages.password.reset ' , ['token ' => $ token ]))
389
- ->line (Nova::__ ('If you did not request a password reset, no further action is required. ' ));
390
- });
391
389
});
392
390
}
393
391
}
0 commit comments