<?php

namespace App\Mail;

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

class CustomDesignMail extends Mailable
{
    use Queueable, SerializesModels;

    public $data;

    public function __construct($data)
    {
        $this->data = $data;
    }

    public function build()
    {
        // return $this->subject('New Project Form Submission')
        //             ->view('emails.custom-design')
        //             ->attach(public_path('upload/' . $this->data))
        // ->with([
        //     'image' => public_path('upload/' . $this->data)
        // ]);
        $imagePath = public_path('uploads/' . $this->data->image);
        return $this->subject('Custom Design')
        ->view('emails.custom-design')
        ->attach($imagePath)
        ->with([
            'imagePath' => $imagePath
        ]);
    }
}