public function verifyEmail($id, $verificationKey) { /** * @var $email Email */ $email = Email::whereId($id)->whereVerificationKey($verificationKey)->first(); if (is_null($email)) { return redirect('/')->withErrors(['Invalid email verification URL.']); } $email->verified = true; $email->save(); return redirect('/'); }