<?php

namespace App\Exports;

use App\Models\Jadwal;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;

class JadwalExport implements FromCollection, WithHeadings
{
    /**
     * @return \Illuminate\Support\Collection
     */
    public function collection()
    {
        return Jadwal::join("tutor", "tutor.id", "=", "jadwal.tutor_id")->get(["tutor.id", "tutor.nama", "jadwal.kelas", "jadwal.hari", "jadwal.jam"]);
    }

    public function headings(): array
    {
        return [
            '#',
            'TUTOR',
            'KELAS',
            'HARI',
            'JAM'
        ];
    }
}
