Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
6ee967f6
Commit
6ee967f6
authored
Sep 14, 2016
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using new Mailable class for the reset password email
parent
ffa8b6de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
6 deletions
+53
-6
ResetPasswordEmail.php
Modules/User/Emails/ResetPasswordEmail.php
+40
-0
SendResetCodeEmail.php
Modules/User/Events/Handlers/SendResetCodeEmail.php
+13
-6
No files found.
Modules/User/Emails/ResetPasswordEmail.php
0 → 100644
View file @
6ee967f6
<?php
namespace
Modules\User\Emails
;
use
Illuminate\Bus\Queueable
;
use
Illuminate\Contracts\Queue\ShouldQueue
;
use
Illuminate\Mail\Mailable
;
use
Illuminate\Queue\SerializesModels
;
use
Modules\User\Entities\UserInterface
;
class
ResetPasswordEmail
extends
Mailable
implements
ShouldQueue
{
use
Queueable
,
SerializesModels
;
/**
* @var UserInterface
*/
public
$user
;
/**
* @var
*/
public
$code
;
protected
$subject
=
'Reset your account password.'
;
public
function
__construct
(
UserInterface
$user
,
$code
)
{
$this
->
user
=
$user
;
$this
->
code
=
$code
;
}
/**
* Build the message.
*
* @return $this
*/
public
function
build
()
{
return
$this
->
view
(
'user::emails.reminder'
);
}
}
Modules/User/Events/Handlers/SendResetCodeEmail.php
View file @
6ee967f6
...
...
@@ -2,19 +2,26 @@
namespace
Modules\User\Events\Handlers
;
use
Illuminate\Contracts\Mail\Mailer
;
use
Illuminate\Mail\Message
;
use
Illuminate\Support\Facades\Mail
;
use
Modules\User\Emails\ResetPasswordEmail
;
use
Modules\User\Events\UserHasBegunResetProcess
;
class
SendResetCodeEmail
{
public
function
handle
(
UserHasBegunResetProcess
$event
)
/**
* @var Mailer
*/
private
$mailer
;
public
function
__construct
(
Mailer
$mailer
)
{
$
user
=
$event
->
us
er
;
$code
=
$event
->
code
;
$
this
->
mailer
=
$mail
er
;
}
Mail
::
queue
(
'user::emails.reminder'
,
compact
(
'user'
,
'code'
),
function
(
Message
$m
)
use
(
$user
)
{
$m
->
to
(
$user
->
email
)
->
subject
(
'Reset your account password.'
);
}
);
public
function
handle
(
UserHasBegunResetProcess
$event
)
{
$this
->
mailer
->
to
(
$event
->
user
->
email
)
->
send
(
new
ResetPasswordEmail
(
$event
->
user
,
$event
->
code
)
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment