mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 20:12:10 +00:00
20 lines
437 B
PHP
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]);
|
|
}
|
|
}
|