master

laravel/framework

Last updated at: 29/12/2023 09:20

CanResetPassword.php

TLDR

This file defines a trait called CanResetPassword in the Illuminate\Auth\Passwords namespace. The trait provides two methods: getEmailForPasswordReset() and sendPasswordResetNotification($token).

Methods

getEmailForPasswordReset()

This method returns the email address where password reset links are sent. It does not accept any parameters and returns a string.

sendPasswordResetNotification($token)

This method sends a password reset notification. It accepts a string parameter $token and does not return anything. It uses the ResetPasswordNotification class to send the notification.

<?php

namespace Illuminate\Auth\Passwords;

use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;

trait CanResetPassword
{
    /**
     * Get the e-mail address where password reset links are sent.
     *
     * @return string
     */
    public function getEmailForPasswordReset()
    {
        return $this->email;
    }

    /**
     * Send the password reset notification.
     *
     * @param  string  $token
     * @return void
     */
    public function sendPasswordResetNotification($token)
    {
        $this->notify(new ResetPasswordNotification($token));
    }
}