Buttons Configurations
Artisan Console Configurations
Namespace configuration is used by the datatables command generator:
<?php return [ 'namespace' => [ 'base' => 'DataTables', 'model' => '', ],];
DataTable Base Namespace/Directory
This is the base namespace/directory to be created when a new DataTable is called. This directory is appended to the default Laravel namespace.
Usage:
php artisan datatables:make User
Output: App\DataTables\UserDataTable
Export filename: users_(timestamp)
Model Option
This is the base namespace/directory where your models are located:
Usage:
php artisan datatables:make Post --model
Output: App\DataTables\PostDataTable
With Model: App\Post
Export filename: posts_(timestamp)
PDF Generator
Set the PDF generator to be used when converting your DataTable to PDF:
'pdf_generator' => 'excel', // or 'snappy'
Available generators are: excel, snappy
Excel Generator
When excel is used as the generator, the package will use maatwebsite/excel to generate the PDF.
[!NOTE] To export files to PDF, you will have to include
dompdf/dompdf,mpdf/mpdf, ortecnick.com/tcpdfin yourcomposer.jsonand change theexport.pdf.driverconfig setting accordingly.
Snappy Generator
When snappy is used as the generator, you need to install barryvdh/laravel-snappy:
composer require barryvdh/laravel-snappy
Snappy PDF Options
These are the options passed to laravel-snappy when exporting the PDF file:
<?php return [ 'snappy' => [ 'options' => [ 'no-outline' => true, 'margin-left' => '0', 'margin-right' => '0', 'margin-top' => '10mm', 'margin-bottom' => '10mm', ], 'orientation' => 'landscape', ],];
See Also
- Buttons Installation - Setup the buttons package
- Buttons Export - Export button options
- Buttons Custom - Custom button actions