Forgot password

You have the option to send an email containing the password reset link to an user. To access this page, just click the “Page examples/ Forgot password” link in the left sidebar or add /forgot-password in the URL.

The app/Http/Livewire/ForgotPassword.php handles the email submission process.

    public $rules=[
        'email' => 'required|email|exists:users'
    ];
    protected $messages = [
        'email.exists' => 'The Email Address must be in our database.',
    ];
    public function updatedEmail()
    {
        $this->validate(['email'=>'required|email|exists:users']);
    }
    public function routeNotificationForMail() {
        return $this->email;
    }
    public function recoverPassword() {
        $this->validate();
        $user=User::where('email', $this->email)->first();
        $this->notify(new ResetPassword($user->id));
        $this->mailSentAlert = true;
        }
    }

The app/Notifications/ResetPassword.php handles the email submission itself. Here you can edit the overall layout of the email.

    public function toMail($notifiable)
    {
        $url = URL::signedRoute('reset-password', ['id' => $this->token]);
        return (new MailMessage)
                    ->subject('Reset your password')
                    ->line('Hey, did you forget your password? Click the button to reset it.')
                    ->action('Reset Password', $url)
                    ->line('Thank you for using our application!');
    }