Laravel Spark User Verification

Ian Fagg
Ian Fagg
Aug 8, 2017 · 2 min read

Update routes:

// Overwrite Spark’s Register function so we can add User Verification…
Route::post(‘/register’, ‘Auth\RegisterController@register’);
// Overwrite Spark’s login function so we can add User Verification…Route::post(‘/login’, ‘Auth\LoginController@login’);// To stop un-verified users getting a reset email…Route::post(‘/password/email’, ‘Auth\PasswordController@sendResetLinkEmail’);

Create RegisterController:

namespace App\Http\Controllers\Auth;
use Illuminate\Auth\Events\Registered;
use Jrean\UserVerification\Traits\VerifiesUsers;
use Jrean\UserVerification\Facades\UserVerification;
use VerifiesUsers;
$this->middleware(‘guest’, [‘except’ => [‘getVerification’, ‘getVerificationError’]]);
$this->redirectTo = Spark::afterLoginRedirect();
$this->redirectAfterVerification = ‘/login’;
public function register(RegisterRequest $request)
$user = Spark::interact(Register::class, [$request]);
event(new UserRegistered($user));
UserVerification::send($user, ‘verification’);
return response()->json([
‘redirect’ => ‘/login’

Create LoginController:

Update Login view:

@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}

Create PasswordController:

Update EventServiceProvider:

// User Verification Events...
'Jrean\UserVerification\Events\VerificationEmailSent' => [
'Jrean\UserVerification\Events\UserVerified' => [

Create AlertUserVerified listener:

Create AlertVerificationEmailSent listener:



Ian Fagg

Written by

Ian Fagg

Web developer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade