<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Exports\CarrerasExport;
use App\Exports\CarrerasFiltradoExport;
use Maatwebsite\Excel\Facades\Excel;

class ExcelController extends Controller
{
    public function exportarCarreras()
    {
        return Excel::download(new CarrerasExport, 'carreras.xlsx');
    }
    public function exportarCarrerasFiltrado(Request $request)
    {
        $data=$request->all();
        $nombre=$data['nombre'];
        $tipo=$data['tipo'];
        if ($nombre==null) {$nombre="";}
        if ($tipo==null) {$tipo="";}
        return Excel::download(new CarrerasExport($nombre,$tipo), 'carreras.xlsx');
    }
}
