SmartCane/laravel_app/app/Mail/ReportGenerated.php
2023-12-12 11:20:05 +01:00

61 lines
1.3 KiB
PHP

<?php
namespace App\Mail;
use App\Models\ProjectMailing;
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 ReportGenerated extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public function __construct(public ProjectMailing $projectMailing)
{
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: $this->projectMailing->project->mail_subject,
from: [
'address' => 'noreply@'.config('app.domain'),
'name' => 'Report Generator',
],
to:$this->projectMailing->recipients->get('mame', 'email')->toArray(),
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'view.name',
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}