<?php

namespace App\Models\Loaders;

use App\Models\ORM\Track;

class PlaylistLoader
{
    public function getPlaylist(): array
    {
        $data = Track::select(
            "tracks.name as Track",
            "performers.name as Performer"
        )->join('performers', function ($join) {
                $join->on('performers.id', "=", "tracks.performer_id")
                    ->where('performers.deleted_at', NULL);
            })->orderBy('performer_id')->get();

        return $data ? $data->toArray() : [];
    }
}
