File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1818 "php" : " >=7.0" ,
1919 "yajra/laravel-datatables-oracle" : " 8.*|9.*" ,
2020 "yajra/laravel-datatables-html" : " 3.*|4.*" ,
21- "maatwebsite/excel" : " ^3.0" ,
2221 "illuminate/console" : " *"
2322 },
2423 "require-dev" : {
2524 "mockery/mockery" : " ~1.0" ,
2625 "phpunit/phpunit" : " ~7.0"
2726 },
28- "suggest" : {
29- "rap2hpoutre/fast-excel" : " Faster exporting of dataTables using fast-excel package." ,
30- "barryvdh/laravel-snappy" : " For exporting of dataTables to PDF."
31- },
3227 "autoload" : {
3328 "psr-4" : {
3429 "Yajra\\ DataTables\\ " : " src/"
5045 }
5146 },
5247 "suggest" : {
48+ "maatwebsite/excel" : " Exporting of dataTables (excel, csv and PDF) using maatwebsite package." ,
49+ "rap2hpoutre/fast-excel" : " Faster exporting of dataTables using fast-excel package." ,
5350 "dompdf/dompdf" : " Allows exporting of dataTable to PDF using the DomPDF." ,
5451 "barryvdh/laravel-snappy" : " Allows exporting of dataTable to PDF using the print view."
5552 },
Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ public function register()
6262 $ this ->mergeConfigFrom (__DIR__ . '/config/config.php ' , 'datatables-buttons ' );
6363
6464 $ this ->app ->register (HtmlServiceProvider::class);
65- $ this ->app ->register (ExcelServiceProvider::class);
65+
66+ if (class_exists (ExcelServiceProvider::class)) {
67+ $ this ->app ->register (ExcelServiceProvider::class);
68+ }
6669 }
6770}
Original file line number Diff line number Diff line change @@ -433,6 +433,10 @@ protected function buildExcelFile()
433433 return $ this ->buildFastExcelFile ();
434434 }
435435
436+ if (! class_exists (\Maatwebsite \Excel \ExcelServiceProvider::class)) {
437+ throw new \Exception ('Please install maatwebsite/excel to be able to use this function. ' );
438+ }
439+
436440 if (! new $ this ->exportClass (collect ()) instanceof DataTablesExportHandler) {
437441 $ collection = $ this ->getAjaxResponseData ();
438442
You can’t perform that action at this time.
0 commit comments