Files
ladill-meet/app/Services/Meet/SpaceService.php
T
isaaccladandCursor be8f76cd47
Deploy Ladill Meet / deploy (push) Successful in 56s
Remove X Spaces reference from Rooms copy.
Drop the third-party comparison from the Rooms index subtitle and neutralize the SpaceService docblock.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-01 19:23:37 +00:00

52 lines
1.2 KiB
PHP

<?php
namespace App\Services\Meet;
use App\Models\Participant;
use App\Models\Room;
use App\Models\User;
class SpaceService
{
/**
* Resolve participant role for an audio-only room join.
*/
public function resolveJoinRole(Room $room, ?User $user, string $fallbackRole = 'guest'): string
{
if ($room->type !== 'space') {
return $fallbackRole;
}
if ($user && $user->ownerRef() === $room->host_user_ref) {
return 'host';
}
$speakerRefs = (array) $room->setting('speaker_refs', []);
if ($user && in_array($user->ownerRef(), $speakerRefs, true)) {
return 'panelist';
}
return 'attendee';
}
public function canPublish(Room $room, Participant $participant): bool
{
if ($room->type !== 'space') {
return true;
}
return in_array($participant->role, ['host', 'co_host', 'panelist'], true);
}
public function isListener(Room $room, Participant $participant): bool
{
return $room->type === 'space' && $participant->role === 'attendee';
}
public function isAudioOnly(Room $room): bool
{
return $room->isSpace() || (bool) $room->setting('audio_only', false);
}
}