67 lines
2.7 KiB
PHP
67 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Mail\Concerns\RidesALane;
|
|
use App\Mail\Concerns\SendsFromMailbox;
|
|
use App\Models\Instance;
|
|
use App\Services\Mail\MailCatalogue;
|
|
use App\Services\Mail\MailPurpose;
|
|
use App\Support\ProvisioningSettings;
|
|
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;
|
|
|
|
/**
|
|
* Die Erinnerung, bevor EndInstanceService die Adresse einzieht.
|
|
*
|
|
* Ab dem Laufzeitende zieht EndInstanceService Route und DNS-Eintrag ein —
|
|
* und ab genau diesem Moment kommt der Kunde nicht mehr an seine eigene
|
|
* Nextcloud. Wer selbst etwas herunterladen will, muss es VORHER tun, und das
|
|
* wusste bisher niemand: nichts im Bestand sagte es ihm. Diese Mail sagt es,
|
|
* mit dem Datum und dem Weg zur eigenen Cloud.
|
|
*
|
|
* Geht an BEIDE Antworten auf die Exportfrage aus ConfirmCancelPackage — wer
|
|
* beim Kündigen „nein" gesagt hat, braucht die Warnung am dringendsten, weil
|
|
* für ihn sonst gar nichts vorbereitet wird. Nur wer „ja" gesagt hat, bekommt
|
|
* zusätzlich den Hinweis, dass ein Export vorbereitet wird (App\Console\
|
|
* Commands\RemindEndingServices entscheidet über das Ob, nicht diese Klasse).
|
|
*/
|
|
class ServiceEndingSoonMail extends Mailable implements ShouldQueue
|
|
{
|
|
use Queueable, RidesALane, SendsFromMailbox, SerializesModels;
|
|
|
|
public function __construct(public Instance $instance)
|
|
{
|
|
$this->mailer(MailCatalogue::mailer('service-ending-soon'));
|
|
}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
return $this->mailboxEnvelope(
|
|
MailPurpose::PROVISIONING,
|
|
__('service_ending.subject', ['date' => $this->instance->service_ends_at->local()->isoFormat('LL')]),
|
|
'service-ending-soon',
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(view: 'mail.service-ending-soon', with: [
|
|
'name' => (string) ($this->instance->customer?->name ?? ''),
|
|
// ->local() (R19): das Datum, das dem Kunden genannt wird, muss
|
|
// seine eigene Wanduhr zeigen, nicht die Speicherzone UTC.
|
|
'date' => $this->instance->service_ends_at->local()->isoFormat('LL'),
|
|
// https:// davor, wie überall sonst, wo Instance::address() zu
|
|
// einer klickbaren Adresse wird (z. B. App\Livewire\
|
|
// Dashboard::domain()) — die eine Stelle, die eigene Domain vor
|
|
// Subdomain entscheidet, statt das hier zu wiederholen.
|
|
'url' => 'https://'.$this->instance->address(ProvisioningSettings::dnsZone()),
|
|
'exportWish' => $this->instance->export_wish,
|
|
]);
|
|
}
|
|
}
|