mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-15 04:26:08 +00:00
fix: refactored the codebase
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?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]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user