mardi 29 décembre 2020

Laravel: {closure}() must be an instance of Illuminate\Mail\Message

I'm trying to make a custom forgot password but when I'm trying to send the email it gives this error

Argument 1 passed to App\Http\Controllers\Auth\PasswordController::App\Http\Controllers\Auth\{closure}() must be an instance of Illuminate\Mail\Message, instance of App\Models\User given, called in D:\laragon\www\laravel8\vendor\laravel\framework\src\Illuminate\Auth\Passwords\PasswordBroker.php

I've tried with these two methods

        $response = Password::sendResetLink($request->only('email'), function (Message $message) {
        
            $message->from('support@test.com', Config::get('APP_NAME'));
            $message->subject($this->getEmailSubject());
            });

Or

public function postEmail(Request $request){
          $response = $this->broker()->sendResetLink(
            $request->only('email'),
            function (Message $message) {
                $message->from('support@test.com', Config::get('APP_NAME'));
                $message->subject($this->getEmailSubject());
            }
        );
}
public function broker()
    {
            return \Illuminate\Support\Facades\Password::broker();
     }

Idk how to make the anonimous function become an instance of message

More info

Trying to update from laravel 5.1 to 8



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3ht5iSb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire