2024-01-24 22:39:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
use App\Values\PlaylistCollaborator;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
|
|
class PlaylistCollaboratorResource extends JsonResource
|
|
|
|
{
|
2024-01-25 16:21:26 +00:00
|
|
|
public const JSON_STRUCTURE = [
|
|
|
|
'type',
|
|
|
|
'id',
|
|
|
|
'name',
|
|
|
|
'avatar',
|
|
|
|
];
|
|
|
|
|
2024-01-24 22:39:47 +00:00
|
|
|
public function __construct(private PlaylistCollaborator $collaborator)
|
|
|
|
{
|
|
|
|
parent::__construct($collaborator);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return array<mixed> */
|
|
|
|
public function toArray($request): array
|
|
|
|
{
|
|
|
|
return [
|
2024-01-26 14:24:46 +00:00
|
|
|
'type' => 'playlist-collaborators',
|
2024-01-24 22:39:47 +00:00
|
|
|
'id' => $this->collaborator->id,
|
|
|
|
'name' => $this->collaborator->name,
|
|
|
|
'avatar' => $this->collaborator->avatar,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|