<?php 

namespace App\Mail;

use Illuminate\Mail\Mailable;
use App\Models\Link;

class DonateLinkMail extends Mailable
{
    public $link;
    public function __construct(Link $link)
    {
        $this->link = $link;
    }

    public function build()
    {
        return $this
            ->from(config('mail.from.address'), config('mail.from.name'))
            ->to($this->link->donateur->email) 
            ->subject("Votre lien de don pour {$this->link->campaign->name}")
            ->view('emails.donate_link')
            ->with([
                'url'             => url("/don/{$this->link->campaign->slug}/{$this->link->token}"),
                'donor'           => $this->link->donateur,
                'campaignMessage' => $this->link->campaign->message,  
                'link' => $this->link,  
                
            ]);
            
    }
}