feat: Initialize core application structure including authentication, role-based dashboards, service task management, and integration workflows.
This commit is contained in:
48
app/Notifications/NewIntegrationRequestNotification.php
Normal file
48
app/Notifications/NewIntegrationRequestNotification.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?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 NewIntegrationRequestNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(public IntegrationRequest $integrationRequest)
|
||||
{
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
$agentName = $this->integrationRequest->agent->first_name . ' ' . $this->integrationRequest->agent->last_name;
|
||||
$type = $this->integrationRequest->type === 'onboarding' ? 'Arrivée' : 'Départ';
|
||||
$createdBy = $this->integrationRequest->agent->creator->name ?? 'Un prescripteur';
|
||||
|
||||
return (new MailMessage)
|
||||
->subject("Nouvelle fiche agent : {$agentName}")
|
||||
->greeting("Bonjour {$notifiable->name},")
|
||||
->line("Une nouvelle fiche agent de type **{$type}** a été initiée par **{$createdBy}**.")
|
||||
->line("Agent concerné : **{$agentName}**")
|
||||
->line("Cette demande est en attente de validation RH.")
|
||||
->action('Voir la demande', route('integrations.show', $this->integrationRequest))
|
||||
->line('Merci de traiter cette demande.');
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'integration_request_id' => $this->integrationRequest->id,
|
||||
'message' => "Nouvelle fiche agent pour {$this->integrationRequest->agent->first_name}",
|
||||
'type' => 'new_request',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user