Files
usher-manage-stack/app/Mail/PaymentSubmittedMail.php

50 lines
1.4 KiB
PHP

<?php
namespace App\Mail;
use App\Models\MembershipPayment;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class PaymentSubmittedMail extends Mailable implements ShouldQueue
{
use Queueable, SerializesModels;
public function __construct(
public MembershipPayment $payment,
public string $recipient // 'member' or 'cashier'
) {
$subject = $this->recipient === 'member'
? 'Payment Submitted Successfully - Awaiting Verification'
: 'New Payment Submitted for Verification - ' . $this->payment->member->full_name;
// Set subject property for assertion compatibility
$this->subject($subject);
}
public function envelope(): Envelope
{
$subject = $this->recipient === 'member'
? 'Payment Submitted Successfully - Awaiting Verification'
: 'New Payment Submitted for Verification - ' . $this->payment->member->full_name;
return new Envelope(subject: $subject);
}
public function content(): Content
{
return new Content(
markdown: 'emails.payments.submitted-' . $this->recipient,
);
}
public function attachments(): array
{
return [];
}
}