4
respostas

Erro

Fui seguindo o passo a passo, tudo certinho, bonitinho mas por algum motivo ao tentar acessar a rota que criei recebo esse erro: "Object of class App\Mail\EsqueciMinhaSenha could not be converted to string", será que alguém poderia me dar uma luz nessa??

4 respostas

Oi João.

Seria interessante você colocar seu código aqui pra gente ver. Talvez fique melhor para identificar o problema...

App\Mail\EsqueciMinhaSenha.php

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class EsqueciMinhaSenha extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('mail.esqueceuSenha');
    }
}

routes\web.php

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/esqueceuSenha', function () {
    return new EsqueciMinhaSenha();
});

resourse\views\mail\esqueceuSenha.blade.php

 Teste Futuro Email

Talvez o problema esteja em como você está usando o Markdown.

Tente fazer um teste por favor. Troque esse trecho:

return $this->markdown('mail.esqueceuSenha');

por esse:

return $this->view('mail.esqueceuSenha');

Se funcionar o problema está na forma como você está usando o markdown.

Talvez tenha que colocar algo assim no arquivo esqueceuSenha.blade.php

@component
 Teste futuro e-mail
endcomponent

Fiz essas mudanças que o senhor mencionou aqui mas infelizmente continuo com o mesmo problema :(