2022-08-10 14:56:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
use App\Models\PlaylistFolder;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
|
|
class PlaylistFolderResource extends JsonResource
|
|
|
|
{
|
2024-01-25 16:21:26 +00:00
|
|
|
public const JSON_STRUCTURE = [
|
|
|
|
'type',
|
|
|
|
'id',
|
|
|
|
'name',
|
|
|
|
'user_id',
|
|
|
|
'created_at',
|
|
|
|
];
|
|
|
|
|
2022-08-10 14:56:01 +00:00
|
|
|
public function __construct(private PlaylistFolder $folder)
|
|
|
|
{
|
|
|
|
parent::__construct($folder);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return array<mixed> */
|
|
|
|
public function toArray($request): array
|
|
|
|
{
|
|
|
|
return [
|
2024-01-26 14:24:46 +00:00
|
|
|
'type' => 'playlist-folders',
|
2022-08-10 14:56:01 +00:00
|
|
|
'id' => $this->folder->id,
|
|
|
|
'name' => $this->folder->name,
|
|
|
|
'user_id' => $this->folder->user_id,
|
|
|
|
'created_at' => $this->folder->created_at,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|