<?php

namespace App\Mail;

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

class SendMail extends Mailable
{
    use Queueable, SerializesModels;

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

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build(Request $request)
    {
        $request->validate([
            'name' => 'required',
            'email' => 'required',
            'sujet' => 'required',
            'message' => 'required',
            'phone' => 'required',
        ]);



        return $this->view( 'mail', [
                            'name'=> $request->name, 
                            'email'=> $request->email,
                            'phone'=> $request->phone,
                            'sujet'=> $request->sujet,
                            'message'=> $request->message])
                    ->to('technoskills.pro@gmail.com');

        // return $this->view('mail')->to('24marokkotransport@gmail.com');


        
      
    }
}
