Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@
"php": ">=7.0",
"yajra/laravel-datatables-oracle": "8.*|9.*",
"yajra/laravel-datatables-html": "3.*|4.*",
"maatwebsite/excel": "^3.0",
"illuminate/console": "*"
},
"require-dev": {
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0"
},
"suggest": {
"rap2hpoutre/fast-excel": "Faster exporting of dataTables using fast-excel package.",
"barryvdh/laravel-snappy": "For exporting of dataTables to PDF."
},
"autoload": {
"psr-4": {
"Yajra\\DataTables\\": "src/"
Expand All @@ -50,6 +45,8 @@
}
},
"suggest": {
"maatwebsite/excel": "Exporting of dataTables (excel, csv and PDF) using maatwebsite package.",
"rap2hpoutre/fast-excel": "Faster exporting of dataTables using fast-excel package.",
"dompdf/dompdf": "Allows exporting of dataTable to PDF using the DomPDF.",
"barryvdh/laravel-snappy": "Allows exporting of dataTable to PDF using the print view."
},
Expand Down
5 changes: 4 additions & 1 deletion src/ButtonsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public function register()
$this->mergeConfigFrom(__DIR__ . '/config/config.php', 'datatables-buttons');

$this->app->register(HtmlServiceProvider::class);
$this->app->register(ExcelServiceProvider::class);

if (class_exists(ExcelServiceProvider::class)) {
$this->app->register(ExcelServiceProvider::class);
}
}
}
4 changes: 4 additions & 0 deletions src/Services/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ protected function buildExcelFile()
return $this->buildFastExcelFile();
}

if (! class_exists(\Maatwebsite\Excel\ExcelServiceProvider::class)) {
throw new \Exception('Please install maatwebsite/excel to be able to use this function.');
}

if (! new $this->exportClass(collect()) instanceof DataTablesExportHandler) {
$collection = $this->getAjaxResponseData();

Expand Down