Recently, I was looking for a simple way to customise the subject and email content of password reset email notification that is included with Laravel. A quick Internet search yielded a few result, but most of them recommend overriding sendPasswordResetNotification
method and use your own Notification
class.
In fact, this is also the method recommended in the official Laravel documentation.
However, there’s an easier way; by extending the default Illuminate\Auth\Notifications\PasswordReset
via the toMailUsing
method, similar to what is recommended to customise the verification email as mentioned in the documentation.
In your AppServiceProvider
, you can do:
|
|
Please note that the second parameter of the callback is the token, so you will need to generate the password reset link yourself. In the example above, I have copied the original implementation that is also available in the PasswordReset
class.