<?php

namespace App\Listeners;

use App\Events\ChatMessageSent;
use App\Models\ChatMessage;

class StoreChatMessage
{
    public function handle(ChatMessageSent $event)
    {
        // Store the message in the database
        ChatMessage::create([
            'message' => $event->message,
            'sender' => $event->sender,
        ]);
    }
}
