Ideenbox-Moderation und Wochenüberblick per E-Mail (0.36.0)
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 6m49s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m19s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m29s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 7m39s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 9m38s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m25s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 7m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m4s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 46s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m9s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 6m49s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m19s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m29s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 7m39s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 9m38s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m25s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 7m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 8m4s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 46s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m9s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
11c5ef5baf
commit
f9922f7308
172 changed files with 1524 additions and 363 deletions
60
app/Mail/WeeklyDigest.php
Normal file
60
app/Mail/WeeklyDigest.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\Branding;
|
||||
use Carbon\CarbonImmutable;
|
||||
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\Mail\Mailables\Headers;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
/**
|
||||
* Wochenüberblick: Neuigkeiten, Termine, Umfragen … der letzten sieben Tage.
|
||||
*/
|
||||
class WeeklyDigest extends Mailable implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @param list<array{key: string, label: string, items: list<array<string, mixed>>}> $sections
|
||||
*/
|
||||
public function __construct(public User $user, public array $sections, public CarbonImmutable $since) {}
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(subject: 'Ihr Wochenüberblick aus '.app(Branding::class)->portalName());
|
||||
}
|
||||
|
||||
public function headers(): Headers
|
||||
{
|
||||
// Abmelden mit einem Klick direkt im E-Mail-Programm (RFC 8058)
|
||||
return new Headers(text: [
|
||||
'List-Unsubscribe' => '<'.$this->unsubscribeUrl().'>',
|
||||
'List-Unsubscribe-Post' => 'List-Unsubscribe=One-Click',
|
||||
]);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(view: 'mail.weekly-digest', with: [
|
||||
'portalName' => app(Branding::class)->portalName(),
|
||||
'color' => app(Branding::class)->primaryColor(),
|
||||
'portalUrl' => url('/'),
|
||||
'profileUrl' => route('profile.edit'),
|
||||
'unsubscribeUrl' => $this->unsubscribeUrl(),
|
||||
'period' => $this->since->timezone(config('app.timezone'))->format('d.m.').' – '.now(config('app.timezone'))->format('d.m.Y'),
|
||||
]);
|
||||
}
|
||||
|
||||
private function unsubscribeUrl(): string
|
||||
{
|
||||
return URL::signedRoute('digest.unsubscribe', ['user' => $this->user->id]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue