Performance: Email verification
Email verification affects page load speed indirectly by adding server-side processing and user interaction delays during account creation and login flows.
public function register(Request $request) {
$user = User::create($request->all());
dispatch(new SendVerificationEmailJob($user));
return redirect('/login')->with('message', 'Check your email for verification link.');
}public function register(Request $request) {
$user = User::create($request->all());
Mail::to($user->email)->send(new VerifyEmail($user));
return redirect('/login')->with('message', 'Check your email for verification link.');
}| Pattern | Server Processing | Network Delay | User Wait Time | Verdict |
|---|---|---|---|---|
| Synchronous email sending | High (blocks request) | High (wait for mail server) | High (delayed response) | [X] Bad |
| Queued email sending | Low (non-blocking) | Medium (background job) | Low (fast response) | [OK] Good |
Route::middleware(['auth', 'verified'])->get('/dashboard', function () {
return 'Welcome to your dashboard!';
});
What happens if a logged-in user tries to access /dashboard without verifying their email?class User extends Authenticatable
{
// Missing implementation here
}
Why might email verification fail to work properly with this model?Pass the test and this pattern moves unknown