Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Laravel check if user model implements email verification

I want to check if email verification in laravel was enabled. The feature can be enabled by implementing the MustVerifyEmail interface on the user model.

But what is a proper laravel way to check if this feature was enabled?

Background: I want to create a command line user creation command that also sends an email verification link, but only if that feature is enabled.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

create a method

public function isMustVerifyEmail():bool
{
  return ($this instanceof MustVerifyEmail);
}

you can use like bellow


$check=$user->isMustVerifyEmail();
dd($check);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading