@@ -116,10 +116,94 @@ public function send(AuthenticatableContract $user, $subject = null, $from = nul
116116 return (boolean ) $ this ->emailVerificationLink ($ user , $ subject , $ from , $ name );
117117 }
118118
119+ /**
120+ * Queue and send by e-mail a link containing the verification token.
121+ *
122+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
123+ * @param string $subject
124+ * @param string $from
125+ * @param string $name
126+ * @return bool
127+ *
128+ * @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException
129+ */
130+ public function sendQueue (AuthenticatableContract $ user , $ subject = null , $ from = null , $ name = null )
131+ {
132+ if (! $ this ->isCompliant ($ user )) {
133+ throw new ModelNotCompliantException ();
134+ }
135+
136+ return (boolean ) $ this ->emailQueueVerificationLink ($ user , $ subject , $ from , $ name );
137+ }
138+
139+ /**
140+ * Queue on the given queue and send by e-mail a link containing the verification token.
141+ *
142+ * @param string $queue
143+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
144+ * @param string $subject
145+ * @param string $from
146+ * @param string $name
147+ * @return bool
148+ *
149+ * @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException
150+ */
151+ public function sendQueueOn ($ queue , AuthenticatableContract $ user , $ subject = null , $ from = null , $ name = null )
152+ {
153+ if (! $ this ->isCompliant ($ user )) {
154+ throw new ModelNotCompliantException ();
155+ }
156+
157+ return (boolean ) $ this ->emailQueueOnVerificationLink ($ queue , $ user , $ subject , $ from , $ name );
158+ }
159+
160+ /**
161+ * Send later by e-mail a link containing the verification token.
162+ *
163+ * @param int $seconds
164+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
165+ * @param string $subject
166+ * @param string $from
167+ * @param string $name
168+ * @return bool
169+ *
170+ * @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException
171+ */
172+ public function sendLater ($ seconds , AuthenticatableContract $ user , $ subject = null , $ from = null , $ name = null )
173+ {
174+ if (! $ this ->isCompliant ($ user )) {
175+ throw new ModelNotCompliantException ();
176+ }
177+
178+ return (boolean ) $ this ->emailLaterVerificationLink ($ seconds , $ user , $ subject , $ from , $ name );
179+ }
180+
181+ /**
182+ * Send later on the given queue by e-mail a link containing the verification token.
183+ *
184+ * @param string $queue
185+ * @param int $seconds
186+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
187+ * @param string $subject
188+ * @param string $from
189+ * @param string $name
190+ * @return bool
191+ *
192+ * @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException
193+ */
194+ public function sendLaterOn ($ queue , $ seconds , AuthenticatableContract $ user , $ subject = null , $ from = null , $ name = null )
195+ {
196+ if (! $ this ->isCompliant ($ user )) {
197+ throw new ModelNotCompliantException ();
198+ }
199+
200+ return (boolean ) $ this ->emailLaterOnVerificationLink ($ queue , $ seconds , $ user , $ subject , $ from , $ name );
201+ }
202+
119203 /**
120204 * Set the e-mail view name.
121205 *
122- * @param mixed $name
206+ * @param string $name
123207 * @return \Jrean\UserVerification
124208 */
125209 public function emailView ($ name )
@@ -256,6 +340,97 @@ protected function emailVerificationLink(AuthenticatableContract $user, $subject
256340 });
257341 }
258342
343+ /**
344+ * Prepare and push a job onto the queue to send the e-mail with the verification token link.
345+ *
346+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
347+ * @param string $subject
348+ * @param string $from
349+ * @param string $name
350+ * @return mixed
351+ */
352+ protected function emailQueueVerificationLink (AuthenticatableContract $ user , $ subject , $ from = null , $ name = null )
353+ {
354+ return $ this ->mailer ->queue ($ this ->emailView , compact ('user ' ), function ($ m ) use ($ user , $ subject , $ from , $ name ) {
355+ if (! empty ($ from )) {
356+ $ m ->from ($ from , $ name );
357+ }
358+
359+ $ m ->to ($ user ->email );
360+
361+ $ m ->subject (is_null ($ subject ) ? 'Your Account Verification Link ' : $ subject );
362+ });
363+ }
364+
365+ /**
366+ * Prepare and push a job onto the given queue to send the e-mail with the verification token link.
367+ *
368+ * @param string $queue
369+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
370+ * @param string $subject
371+ * @param string $from
372+ * @param string $name
373+ * @return mixed
374+ */
375+ protected function emailQueueOnVerificationLink ($ queue , AuthenticatableContract $ user , $ subject , $ from = null , $ name = null )
376+ {
377+ return $ this ->mailer ->queueOn ($ queue , $ this ->emailView , compact ('user ' ), function ($ m ) use ($ user , $ subject , $ from , $ name ) {
378+ if (! empty ($ from )) {
379+ $ m ->from ($ from , $ name );
380+ }
381+
382+ $ m ->to ($ user ->email );
383+
384+ $ m ->subject (is_null ($ subject ) ? 'Your Account Verification Link ' : $ subject );
385+ });
386+ }
387+
388+ /**
389+ * Prepare and send later the e-mail with the verification token link.
390+ *
391+ * @param int $seconds
392+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
393+ * @param string $subject
394+ * @param string $from
395+ * @param string $name
396+ * @return mixed
397+ */
398+ protected function emailLaterVerificationLink ($ seconds , AuthenticatableContract $ user , $ subject , $ from = null , $ name = null )
399+ {
400+ return $ this ->mailer ->later ($ seconds , $ this ->emailView , compact ('user ' ), function ($ m ) use ($ user , $ subject , $ from , $ name ) {
401+ if (! empty ($ from )) {
402+ $ m ->from ($ from , $ name );
403+ }
404+
405+ $ m ->to ($ user ->email );
406+
407+ $ m ->subject (is_null ($ subject ) ? 'Your Account Verification Link ' : $ subject );
408+ });
409+ }
410+
411+ /**
412+ * Prepare and send later on the given queue the e-mail with the verification token link.
413+ *
414+ * @param int $seconds
415+ * @param \Illuminate\Contracts\Auth\Authenticatable $user
416+ * @param string $subject
417+ * @param string $from
418+ * @param string $name
419+ * @return mixed
420+ */
421+ protected function emailLaterOnVerificationLink ($ queue , $ seconds , AuthenticatableContract $ user , $ subject , $ from = null , $ name = null )
422+ {
423+ return $ this ->mailer ->laterOn ($ queue , $ seconds , $ this ->emailView , compact ('user ' ), function ($ m ) use ($ user , $ subject , $ from , $ name ) {
424+ if (! empty ($ from )) {
425+ $ m ->from ($ from , $ name );
426+ }
427+
428+ $ m ->to ($ user ->email );
429+
430+ $ m ->subject (is_null ($ subject ) ? 'Your Account Verification Link ' : $ subject );
431+ });
432+ }
433+
259434 /**
260435 * Determine if the given model table has the verified and verification_token
261436 * columns.
0 commit comments