E-Mail-Praeferenzen: Opt-out je Mail-Typ + One-Click-Unsubscribe ohne Login

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin Adametz 2026-07-10 17:15:05 +00:00
parent 484e062264
commit d5b806443e
21 changed files with 746 additions and 9 deletions

View file

@ -0,0 +1,40 @@
<?php
namespace App\Models;
use App\Enums\EmailNotificationType;
use Database\Factories\EmailNotificationOptOutFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Abbestellter Benachrichtigungs-Mail-Typ eines Users (Opt-out-Register).
* Existiert eine Zeile, wird die entsprechende Mail nicht mehr versendet —
* geprüft über User::wantsEmailNotification() vor jedem Versand.
*/
class EmailNotificationOptOut extends Model
{
/** @use HasFactory<EmailNotificationOptOutFactory> */
use HasFactory;
protected $fillable = [
'user_id',
'type',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'type' => EmailNotificationType::class,
];
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}