<?php

namespace App\Models\Loaders;

use App\Models\ORM\Track;

class PlaylistLoader
{
    public function getPlaylist(): array
    {
        $data = Track::select(
            "Track.Name as Track",
            "Performer.Name as Performer"
        )->join('Performer', function ($join) {
                $join->on('Performer.Id', "=", "Track.Performer")
                    ->where('Performer.DeleteDate', NULL);
            })->orderBy('Performer')->get();

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