PHP code example of yajra / laravel-datatables-export
1. Go to this page and download the library: Download yajra/laravel-datatables-export library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yajra / laravel-datatables-export example snippets
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\WithExportQueue;
class UsersDataTable extends DataTable
{
use WithExportQueue;
public function html(): HtmlBuilder
{
return $this->builder()
->buttons([
Button::make([
'extend' => 'queuedExport',
'text' => 'Export Excel',
'exportType' => 'xlsx',
'filename' => 'users.xlsx',
'sheetName' => 'Users',
'autoDownload' => true,
]),
]);
}
}
use Yajra\DataTables\WithExportQueue;
class PermissionsDataTable extends DataTable
{
use WithExportQueue;
...
}