@@ -47,6 +47,10 @@ public function __construct(Mailer $mailer, Builder $schema)
4747 {
4848 $ this  ->mailer  = $ mailer ;
4949 $ this  ->schema  = $ schema ;
50+ 
51+  if  (! $ this  ->isCompliant ()) {
52+  throw  new  ModelNotCompliantException ();
53+  }
5054 }
5155
5256 /** 
@@ -85,10 +89,6 @@ protected function generateToken()
8589 */ 
8690 protected  function  saveToken (AuthenticatableContract   $ user , $ token )
8791 {
88-  if  (! $ this  ->isCompliant ($ user )) {
89-  throw  new  ModelNotCompliantException ();
90-  }
91- 
9292 $ user ->verified  = false ;
9393
9494 $ user ->verification_token  = $ token ;
@@ -114,10 +114,6 @@ public function send(
114114 $ name  = null 
115115 )
116116 {
117-  if  (! $ this  ->isCompliant ($ user )) {
118-  throw  new  ModelNotCompliantException ();
119-  }
120- 
121117 $ this  ->emailVerificationLink ($ user , $ subject , $ from , $ name );
122118
123119 event (new  VerificationEmailSent ($ user ));
@@ -141,10 +137,6 @@ public function sendQueue(
141137 $ name  = null 
142138 )
143139 {
144-  if  (! $ this  ->isCompliant ($ user )) {
145-  throw  new  ModelNotCompliantException ();
146-  }
147- 
148140 $ this  ->emailQueueVerificationLink ($ user , $ subject , $ from , $ name );
149141
150142 event (new  VerificationEmailSent ($ user ));
@@ -170,10 +162,6 @@ public function sendLater(
170162 $ name  = null 
171163 )
172164 {
173-  if  (! $ this  ->isCompliant ($ user )) {
174-  throw  new  ModelNotCompliantException ();
175-  }
176- 
177165 $ this  ->emailLaterVerificationLink ($ delay , $ user , $ subject , $ from , $ name );
178166
179167 event (new  VerificationEmailSent ($ user ));
@@ -336,6 +324,8 @@ protected function wasVerified($user)
336324
337325 $ user ->verified  = true ;
338326
327+  $ user ->verified_at  = now ();
328+ 
339329 $ this  ->updateUser ($ user );
340330
341331 event (new  UserVerified ($ user ));
@@ -353,34 +343,21 @@ protected function updateUser($user)
353343 ->where ('email ' , $ user ->email )
354344 ->update ([
355345 'verification_token '  => $ user ->verification_token ,
356-  'verified '  => $ user ->verified 
346+  'verified '  => $ user ->verified ,
347+  'email_verified_at '  => $ user ->verified_at ,
357348 ]);
358349 }
359350
360351 /** 
361352 * Determine if the given model table has the verified and verification_token 
362353 * columns. 
363354 * 
364-  * @param \Illuminate\Contracts\Auth\Authenticatable $user 
365355 * @return bool 
366356 */ 
367-  protected  function  isCompliant (AuthenticatableContract   $ user  )
357+  protected  function  isCompliant ()
368358 {
369-  return  $ this  ->hasColumn ($ user , 'verified ' )
370-  && $ this  ->hasColumn ($ user , 'verification_token ' )
371-  ? true 
372-  : false ;
373-  }
359+  $ user  = config ('auth.providers.users.model ' , App \User::class);
374360
375-  /** 
376-  * Check if the given model talbe has the given column. 
377-  * 
378-  * @param \Illuminate\Contracts\Auth\Authenticatable $user 
379-  * @param string $column 
380-  * @return bool 
381-  */ 
382-  protected  function  hasColumn (AuthenticatableContract   $ user , $ column )
383-  {
384-  return  $ this  ->schema ->hasColumn ($ user ->getTable (), $ column );
361+  return  $ this  ->schema ->hasColumns ((new  $ user ())->getTable (), ['verified ' , 'verification_token ' ])? true  : false ;
385362 }
386363}
0 commit comments