<?php

namespace App\Mail;

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

class DynamicMail extends Mailable
{
    use SerializesModels;

    public $subjectContent;
    public $bodyContent;

    public function __construct($subject, $body)
    {
        $this->subjectContent = $subject;
        $this->bodyContent = $body;
    }

    public function build()
    {
        return $this->subject($this->subjectContent)
                    ->view('emails.dynamic')
                    ->with([
                        'body' => $this->bodyContent,
                        'subject' => $this->subjectContent
                    ]);
    }
}
