<?php
namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Log;

class CustomMail extends Mailable
{
    use Queueable, SerializesModels;

    public $subject;
    public $emailMessage;

    public function __construct(string $subject, string $emailMessage)
    {
        $this->subject      = $subject;
        $this->emailMessage = $emailMessage;
    }

    public function build()
    {
        Log::info('mail send log test:', [
            'subject'      => $this->subject,
            'emailMessage' => $this->emailMessage,
        ]);

        return $this->subject($this->subject)
            ->view('emails.custom')
            ->with([
                'subject'      => $this->subject,
                'emailMessage' => $this->emailMessage,
            ]);
    }
}
