<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use App\Models\BorrowTransaction;

class BukuDikembalikanMail extends Mailable
{
    use Queueable, SerializesModels;

    public $transaction;

    public function __construct(BorrowTransaction $transaction)
    {
        $this->transaction = $transaction->loadMissing(['anggota', 'koleksi']);
    }

    public function build()
    {
        return $this->subject('Konfirmasi Pengembalian Buku')
                    ->view('emails.buku_dikembalikan')
                    ->with([
                        'transaction' => $this->transaction,
                    ]);
    }
}

