laravel 降价不识别视图

e5nqia27  于 2023-03-19  发布在  其他
关注(0)|答案(1)|浏览(143)

我有这个代码:

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;

use App\Mail\ContatoRecebido;
use App\Mail\ContatoRespondido;

class ContatoController extends Controller
{
    //
    protected $mailto = 'email@gmail.com';

    public function showForm()
    {
        return view('emails.contato');
    }

    public function sendForm(Request $request)
    {       
        $request->validate([
            'nome' => 'required',
            'email' => 'required|email',
            'mensagem' => 'required',
        ]);      
        $recebido   =  new ContatoRecebido ($request);
        $respondido =  new ContatoRespondido($request);
        Mail::to($this->mailto)->send( $recebido);
        // Envia o e-mail de resposta para o remetente
        Mail::to($request->email)->send($respondido);
        return redirect('contato')->with('success', 'Mensagem enviada com sucesso!');
    }

以及

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

class ContatoRespondido extends Mailable
{
    use Queueable, SerializesModels;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public $dados;

    public function __construct($dados)
    {
        $this->dados = $dados;
    }
    
    public function build()
    {
        $array = [
            'nome' => $this->dados->nome,
            'email' => $this->dados->email,
        ];

     #   dd ( $array );

       # return $this->markdown->render('emails.envia')->with($array);
        #return $this->markdown('emails.envia', $array);
        return $this->markdown('emails.enviaestatico');
    }
}

但是,当我试图逃跑的时候,我收到了:参数无效异常未找到视图[]。(视图:/主页/hotckless/www/institutoami/resources/views/emails/enviaestatico. blade. php)
但是视图('enviaestatico'(. blade.php)存在于视图/电子邮件/文件夹中。
我都快疯了。
我尝试将目标更改为静态文件,尝试将Markdown更改为View:return $this-〉view('...'),并尝试创建www.example.com文件的路径view.app,并创建了'mail' =〉resource_path('views/emails'),但没有任何React!

相关问题