adam78
adam78

Reputation: 10078

Laravel 5.7 - MustVerifyEmail abstract methods must be declared

I have the following user model:

use Illuminate\Contracts\Auth\MustVerifyEmail;

class User extends Model implements AuthenticatableContract,
                                    AuthorizableContract,
                                    CanResetPasswordContract,
                                    MustVerifyEmail {

   use Authenticatable, Authorizable, CanResetPassword, HasApiTokens, Notifiable;

  public function sendEmailVerificationNotification()
  {
    $this->notify(new VerifyEmailNotification());
  }

  //...
}

However I'm getting the following error:

 Class App\User contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Auth\MustVerifyEmail::hasVerifiedEmail, Illuminate\Contracts\Auth\MustVerifyEmail::markEmailAsVerified) 

Why do I need to implement these two methods. Theres nothing in the docs regarding this?

Upvotes: 0

Views: 1232

Answers (1)

Robert
Robert

Reputation: 5963

Those methods are available in the MustVerifyEmail trait.

use \Illuminate\Auth\MustVerifyEmail;

See: Illuminate/Auth/MustVerifyEmail.php

Either add this trait and/or overload whatever you want, or add the other 2 methods and add your own business logic.

Upvotes: 1

Related Questions