Files
scrum-poker-internal/app/Services/Rooms/FavoriteRoomService.php
T
2026-08-20 23:00:47 +02:00

20 lines
437 B
PHP

<?php
namespace App\Services\Rooms;
use App\Models\Room;
use App\Models\User;
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
class FavoriteRoomService
{
public function toggle(User $user, Room $room): void
{
if ($room->owner_id === $user->id) {
throw new ConflictHttpException('Lobby is already yours', null, 409);
}
$user->favoriteRooms()->toggle([$room->id]);
}
}