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', ]; } }