'int', 'user_id' => 'int', 'metadata' => 'array', ]; protected $fillable = [ 'newsletter_contact_id', 'action', 'description', 'metadata', 'user_id', ]; // Aktions-Konstanten const ACTION_SUBSCRIBED = 'subscribed'; const ACTION_UNSUBSCRIBED = 'unsubscribed'; const ACTION_BOOKING_ADDED = 'booking_added'; const ACTION_STATUS_CHANGED = 'status_changed'; const ACTION_GROUP_CHANGED = 'group_changed'; const ACTION_EMAIL_SENT = 'email_sent'; const ACTION_BOUNCED = 'bounced'; public static $actionLabels = [ self::ACTION_SUBSCRIBED => 'Angemeldet', self::ACTION_UNSUBSCRIBED => 'Abgemeldet', self::ACTION_BOOKING_ADDED => 'Buchung hinzugefügt', self::ACTION_STATUS_CHANGED => 'Status geändert', self::ACTION_GROUP_CHANGED => 'Gruppe geändert', self::ACTION_EMAIL_SENT => 'E-Mail versendet', self::ACTION_BOUNCED => 'Bounced', ]; /** * Beziehung zum Newsletter-Kontakt */ public function newsletter_contact() { return $this->belongsTo(NewsletterContact::class, 'newsletter_contact_id'); } /** * Beziehung zum Admin-User */ public function user() { return $this->belongsTo(SfGuardUser::class, 'user_id'); } /** * Action-Label */ public function getActionLabelAttribute() { return self::$actionLabels[$this->action] ?? $this->action; } }