feat: Initialize core application structure including authentication, role-based dashboards, service task management, and integration workflows.
This commit is contained in:
40
app/Notifications/IntegrationCompletedWithAttachment.php
Normal file
40
app/Notifications/IntegrationCompletedWithAttachment.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\IntegrationRequest;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class IntegrationCompletedWithAttachment extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public IntegrationRequest $integrationRequest,
|
||||
public string $base64PdfContent
|
||||
) {}
|
||||
|
||||
public function via($notifiable): array
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
public function toMail($notifiable): MailMessage
|
||||
{
|
||||
$agentName = $this->integrationRequest->agent->first_name . ' ' . $this->integrationRequest->agent->last_name;
|
||||
$filename = "Fiche_Agent_{$this->integrationRequest->agent->last_name}_{$this->integrationRequest->agent->first_name}.pdf";
|
||||
|
||||
$pdfContent = base64_decode($this->base64PdfContent);
|
||||
|
||||
return (new MailMessage)
|
||||
->subject("Intégration terminée - {$agentName}")
|
||||
->line("L'intégration de l'agent {$agentName} est désormais terminée.")
|
||||
->line("Veuillez trouver la fiche agent récapitulative en pièce jointe.")
|
||||
->attachData($pdfContent, $filename, [
|
||||
'mime' => 'application/pdf',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user