arm092 / livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS (Fork of MedicOneSystems/livewire-datatables but with updating dependencies and support new Laravel versions in time)
https://livewire-datatables.com/
MIT License
26 stars 11 forks source link

problem with exports in maatwebsite #14

Closed typedpie closed 7 months ago

typedpie commented 7 months ago

i got a variable with info i pull from a data base, and when i try to use the command: return Excel::download(new ProyectoExports ($resultados), 'nombre_archivo.xlsx'); i get the error: Class` "app\Exports\ProyectoExports" not found

this is mi code:

controller.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use  Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Doctrine\DBAL\Driver;

use Maatwebsite\Excel\Facades\Excel;
use app\Exports\ResultadosExport;
use app\Exports\ProyectoExports;

public function descargarExcel(Request $request)
    {
      $resultados = session('resultados');
      return Excel::download(new ProyectoExports ($resultados), 'nombre_archivo.xlsx');   
    }

ProyectoExports.php

<?php

namespace App\Exports;

use Maatwebsite\Excel\Concerns\FromCollection;
use Illuminate\Support\Collection;

class ProyectoExports implements FromCollection
{
    /**
    * @return \Illuminate\Support\Collection
    */
    protected $resultados;

    public function __construct(Collection $resultados)
    {
        $this->resultados = $resultados;
    }

    public function collection()
    {
        return $this->resultados;
    }
}

already tried to use the command: compose dump-autoload

arm092 commented 7 months ago

That is not issue in this package, you need to check it with excel package. Address your issue to them: https://github.com/SpartnerNL/Laravel-Excel/issues