EmailVerificationNotificationController.php 711 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Http\Controllers\Controller;
  4. use App\Providers\RouteServiceProvider;
  5. use Illuminate\Http\Request;
  6. class EmailVerificationNotificationController extends Controller
  7. {
  8. /**
  9. * Send a new email verification notification.
  10. *
  11. * @param \Illuminate\Http\Request $request
  12. * @return \Illuminate\Http\RedirectResponse
  13. */
  14. public function store(Request $request)
  15. {
  16. if ($request->user()->hasVerifiedEmail()) {
  17. return redirect()->intended(RouteServiceProvider::HOME);
  18. }
  19. $request->user()->sendEmailVerificationNotification();
  20. return back()->with('status', 'verification-link-sent');
  21. }
  22. }