Created
October 23, 2017 12:38
-
-
Save XavRsl/018113c5232498df2224c26c3769de95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Http\Controllers\Controller; | |
class SubscriberVerificationController extends Controller { | |
public function update(Request $request) | |
{ | |
$request->validate(['token' => 'required|alpha_num:40']); | |
try { | |
$subscriber = JournalSubscriber::findOrFail((new ModelHasher())->decode($request->token)); | |
$subscriber->update(['verified' => true]); | |
} catch (ModeNotFoundException $e) { | |
flash()->error('Cannot verify your email. Something went wrong.'); | |
return redirect('/'); | |
} | |
flash()->info('Your email has been verified. Thank you.'); | |
return redirect('/'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment