<?php

namespace App\Exports\Examen\Admision;

use App\Exports\Examen\Admision\ResultadosExport;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;

use App\RFCarrera;

class ResultadosSheetExport implements WithMultipleSheets
{
    use Exportable;

    protected $data;
    
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * @return array
     */
    public function sheets(): array
    {
        $carreras = RFCarrera::where('estado', '1')->where('tipo', 'like', 'LICENCIATURA')->get();
        //dd($carreras);
        $sheets = [];

        foreach ($carreras as $c) {
            $this->data['carrera'] = $c->id;
            $sheets[] = new ResultadosExport($this->data, $c->abreviatura);
        }
        
        return $sheets;
    }
}