Skip to content

Instantly share code, notes, and snippets.

@XavRsl
Created October 23, 2017 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XavRsl/018113c5232498df2224c26c3769de95 to your computer and use it in GitHub Desktop.
Save XavRsl/018113c5232498df2224c26c3769de95 to your computer and use it in GitHub Desktop.
<?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