Files
timebank-cc-public/app/Observers/ConversationObserver.php
Ronald Huynen 2547717edb Initial commit
2026-03-23 21:37:59 +01:00

23 lines
663 B
PHP

<?php
namespace App\Observers;
use Namu\WireChat\Models\Conversation;
class ConversationObserver
{
/**
* Handle the Conversation "created" event.
*/
public function created(Conversation $conversation): void
{
// Automatically set disappearing fields (always enabled to prevent orphaned messages)
$durationInDays = timebank_config('wirechat.disappearing_messages.duration', 30);
$durationInSeconds = $durationInDays * 86400; // Convert days to seconds
$conversation->disappearing_started_at = now();
$conversation->disappearing_duration = $durationInSeconds;
$conversation->save();
}
}