This commit is contained in:
RafficMohammed
2023-02-17 13:25:50 +05:30
parent 2381fd7cf5
commit 67950fc78f
891 changed files with 102300 additions and 138477 deletions

View File

@@ -2,9 +2,11 @@
namespace App\Http\Controllers\Common;
use App\Exports\UserExport;
use App\Http\Controllers\Controller;
use Excel;
//use Excel;
use Exception;
use Maatwebsite\Excel\Facades\Excel;
class ExcelController extends Controller
{
@@ -13,10 +15,7 @@ class ExcelController extends Controller
if (count($data) == 0) {
throw new Exception('No data');
}
Excel::create($filename, function ($excel) use ($data) {
$excel->sheet('sheet', function ($sheet) use ($data) {
$sheet->fromArray($data);
});
})->export('xls');
//dd(Excel::download(new UserExport($data), $filename.'.'.'xls'));
return Excel::download(new UserExport(), $filename.'.'.'xls');
}
}