Viewing file: VerificationController.php (2.1 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use App\Providers\RouteServiceProvider; use Illuminate\Foundation\Auth\VerifiesEmails; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request;
class VerificationController extends Controller { /* |-------------------------------------------------------------------------- | Email Verification Controller |-------------------------------------------------------------------------- | | This controller is responsible for handling email verification for any | user that recently registered with the application. Emails may also | be re-sent if the user didn't receive the original email message. | */
use VerifiesEmails;
/** * Where to redirect users after verification. * * @var string */ protected $redirectTo = RouteServiceProvider::HOME;
/** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('auth'); $this->middleware('signed')->only('verify'); $this->middleware('throttle:6,1')->only('verify', 'resend'); }
//for override the default traits public function show(Request $request) { return $request->user()->hasVerifiedEmail() ? redirect($this->redirectPath()) : view('frontend.auth.verify-email'); }
/** * Resend the email verification notification. * * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ public function resend(Request $request) { if ($request->user()->hasVerifiedEmail()) { return $request->wantsJson() ? new JsonResponse([], 204) : redirect($this->redirectPath()); }
$request->user()->sendEmailVerificationNotification();
flashSuccess('A fresh verification link has been sent to your email address.');
return $request->wantsJson() ? new JsonResponse([], 202) : back()->with('resent', true); } }
|