mirror of
https://github.com/koel/koel
synced 2024-12-19 09:03:07 +00:00
27 lines
596 B
PHP
27 lines
596 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Resources;
|
||
|
|
||
|
use App\Models\Artist;
|
||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
||
|
class ArtistResource extends JsonResource
|
||
|
{
|
||
|
public function __construct(private Artist $artist)
|
||
|
{
|
||
|
parent::__construct($artist);
|
||
|
}
|
||
|
|
||
|
/** @return array<mixed> */
|
||
|
public function toArray($request): array
|
||
|
{
|
||
|
return [
|
||
|
'type' => 'artists',
|
||
|
'id' => $this->artist->id,
|
||
|
'name' => $this->artist->name,
|
||
|
'image' => $this->artist->image,
|
||
|
'created_at' => $this->artist->created_at,
|
||
|
];
|
||
|
}
|
||
|
}
|