koel/app/Http/Resources/PlaylistCollaboratorResource.php

33 lines
747 B
PHP
Raw Normal View History

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
{
public const JSON_STRUCTURE = [
'type',
'id',
'name',
'avatar',
];
2024-04-18 14:36:28 +00:00
public function __construct(private readonly PlaylistCollaborator $collaborator)
2024-01-24 22:39:47 +00:00
{
parent::__construct($collaborator);
}
/** @return array<mixed> */
public function toArray($request): array
{
return [
'type' => 'playlist-collaborators',
2024-01-24 22:39:47 +00:00
'id' => $this->collaborator->id,
'name' => $this->collaborator->name,
'avatar' => $this->collaborator->avatar,
];
}
}