1
votes

I have a email verification system added in my Laravel app. I have used "jrean's" package for it.

Now I want to override the getVerification() function in VerifiesUsers trait. For which I have added a function with same name inside my RegisterController.

public function getVerification(Request $request, $token)

{    

 $this->validateRequest($request);

 try {
    UserVerification::process($request->input('email'), $token, $this->userTable());
 } catch (UserNotFoundException $e) {
    return redirect($this->redirectIfVerificationFails());
 } catch (UserIsVerifiedException $e) {
    return redirect($this->redirectIfVerified());
 } catch (TokenMismatchException $e) {
    return redirect($this->redirectIfVerificationFails());
 }

 $request->session()->flash('message', 'Email address has been successfully verified');
 return redirect($this->redirectAfterVerification());
}

But when my function gets called as per the verification call, I am getting the error "Session store not set on request." error. I am not sure what does it exactly mean and how to resolve it.

1

1 Answers

3
votes

The reason this is happening is because the routes that are declared in the package are not put inside the web middleware.

To get around this you can add the routes from that package in to your routes/web.php. The routes are:

Route::get('email-verification/error', 'Auth\RegisterController@getVerificationError')->name('email-verification.error');
Route::get('email-verification/check/{token}', 'Auth\RegisterController@getVerification')->name('email-verification.check');

The your will just need to make sure that you in your config/app.php the Jrean\UserVerification\UserVerificationServiceProvider::class, line is above your App service providers (but underneath your Illuminate service providers).

Hope this helps!