38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class NewContactNotification extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
public function __construct(
|
|
private readonly string $customerName,
|
|
private readonly string $customerEmail,
|
|
private readonly string $customerMessage
|
|
) {}
|
|
|
|
public function via($notifiable): array
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
public function toMail($notifiable): MailMessage
|
|
{
|
|
return (new MailMessage)
|
|
->subject('New Contact Submission: '.$this->customerName)
|
|
->greeting('Hello Admin,') // Or keep it empty if you prefer
|
|
->line('You have received a new message from your contact form:')
|
|
->line("**Name:** {$this->customerName}")
|
|
->line("**Email:** {$this->customerEmail}")
|
|
->line('**Message:**')
|
|
->line($this->customerMessage)
|
|
->action('Reply via Email', 'mailto:'.$this->customerEmail);
|
|
}
|
|
}
|