Files
ladill-meet/app/Services/Meet/ChatService.php
T
isaaccladandCursor 965fb992e9
Deploy Ladill Meet / deploy (push) Failing after 7s
Initial Ladill Meet release.
Phases 0–18: core meetings, webinar, breakouts, team chat, live streaming, town hall, billing, and Ladill Mail calendar wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 23:35:29 +00:00

56 lines
1.4 KiB
PHP

<?php
namespace App\Services\Meet;
use App\Models\Message;
use App\Models\Reaction;
use App\Models\Session;
class ChatService
{
public function sendPublicMessage(
Session $session,
string $senderName,
string $body,
?string $senderRef = null,
): Message {
return Message::create([
'owner_ref' => $session->owner_ref,
'session_id' => $session->id,
'sender_ref' => $senderRef,
'sender_name' => $senderName,
'type' => 'public',
'body' => $body,
]);
}
public function sendReaction(
Session $session,
string $senderName,
string $emoji,
?string $participantRef = null,
): Reaction {
return Reaction::create([
'owner_ref' => $session->owner_ref,
'session_id' => $session->id,
'participant_ref' => $participantRef,
'sender_name' => $senderName,
'emoji' => $emoji,
]);
}
/**
* @return \Illuminate\Database\Eloquent\Collection<int, Message>
*/
public function recentMessages(Session $session, int $limit = 100)
{
return $session->messages()
->where('type', 'public')
->orderByDesc('created_at')
->limit($limit)
->get()
->reverse()
->values();
}
}