mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 18:12:09 +00:00
29 lines
708 B
PHP
29 lines
708 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Data\Rooms\RoomPageData;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class CurrentPlayerResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
/** @var RoomPageData $pageData */
|
|
$pageData = $this->resource;
|
|
$player = $pageData->currentPlayer;
|
|
|
|
return [
|
|
'id' => $player->id,
|
|
'instance_id' => $player->active_instance_id,
|
|
'name' => $player->name,
|
|
'is_moderator' => $player->is_moderator,
|
|
'current_vote' => $pageData->currentVote,
|
|
];
|
|
}
|
|
}
|