Add AdminMessageResponse

This commit is contained in:
Daniel Supernault 2024-10-10 01:56:52 -06:00
parent 11da5605b2
commit 1173e63a45
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
2 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,71 @@
<?php
namespace App\Mail;
use App\Contact;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Mail\Mailables\Headers;
use Illuminate\Queue\SerializesModels;
class AdminMessageResponse extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public function __construct(
public Contact $contact,
) {}
/**
* Get the message headers.
*/
public function headers(): Headers
{
$mid = $this->contact->getMessageId();
return new Headers(
messageId: $mid,
text: [
'X-Entity-Ref-ID' => $mid,
],
);
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: ucfirst(strtolower(config('pixelfed.domain.app'))).' Contact Form Response [Ticket #'.$this->contact->id.']',
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
markdown: 'emails.contact.admin-response',
with: [
'url' => $this->contact->userResponseUrl(),
],
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}

View file

@ -0,0 +1,24 @@
<x-mail::message>
Hello **&commat;{{$contact->user->username}}**,
You contacted the admin team of {{config('pixelfed.domain.app')}} with the following inquiry:
<x-mail::panel>
<i>{{str_limit($contact->message, 80)}}</i>
</x-mail::panel>
<x-mail::button :url="$url" color="primary">
View Admin Response
</x-mail::button>
<small>
or copy and paste the following url: <a href="{{$url}}">{{$url}}</a>
</small>
<br>
<br>
<br>
<small>
Thanks,<br>
The {{ ucfirst(config('pixelfed.domain.app')) }} Admin Team
</small>
</x-mail::message>