user(); if ($customerModel instanceof MustVerifyEmail) { $crmCustomer = CrmCustomer::findWithEmail($customerModel->email); // Check there is a crm customer. if (! $crmCustomer) { $customerModel->delete(); } else { // Check the status of crm customer & customer model. if ($crmCustomer->status !== $customerModel->hasVerifiedEmail()) { $customerModel->email_verified_at = $crmCustomer->status ? Carbon::now() : null; $customerModel->saveOrFail(); } if (! $crmCustomer->status && ! $customerModel->hasVerifiedEmail()) { return $request->expectsJson() ? abort(403, 'Your email address is not verified.') : Redirect::guest(URL::route($redirectToRoute ?: 'club.verification.notice')); } } } return $next($request); } }