mirror of
https://github.com/koel/koel
synced 2024-11-28 15:00:42 +00:00
29 lines
695 B
PHP
29 lines
695 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Resources;
|
||
|
|
||
|
use App\Models\Album;
|
||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
||
|
class AlbumResource extends JsonResource
|
||
|
{
|
||
|
public function __construct(private Album $album)
|
||
|
{
|
||
|
parent::__construct($album);
|
||
|
}
|
||
|
|
||
|
/** @return array<mixed> */
|
||
|
public function toArray($request): array
|
||
|
{
|
||
|
return [
|
||
|
'type' => 'albums',
|
||
|
'id' => $this->album->id,
|
||
|
'name' => $this->album->name,
|
||
|
'artist_id' => $this->album->artist_id,
|
||
|
'artist_name' => $this->album->artist->name,
|
||
|
'cover' => $this->album->cover,
|
||
|
'created_at' => $this->album->created_at,
|
||
|
];
|
||
|
}
|
||
|
}
|