mirror of
https://github.com/koel/koel
synced 2024-12-23 19:13:06 +00:00
26 lines
549 B
PHP
26 lines
549 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Resources;
|
||
|
|
||
|
use App\Values\Genre;
|
||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
||
|
class GenreResource extends JsonResource
|
||
|
{
|
||
|
public function __construct(private Genre $genre)
|
||
|
{
|
||
|
parent::__construct($genre);
|
||
|
}
|
||
|
|
||
|
/** @return array<mixed> */
|
||
|
public function toArray($request): array
|
||
|
{
|
||
|
return [
|
||
|
'type' => 'genres',
|
||
|
'name' => $this->genre->name,
|
||
|
'song_count' => $this->genre->songCount,
|
||
|
'length' => $this->genre->length,
|
||
|
];
|
||
|
}
|
||
|
}
|