Skip to content

WARNING You're browsing the documentation for an upcoming version of Laravel DataTables. The documentation and features of this release are subject to change.

Buttons Quick Starter

Create Users DataTable

php artisan datatables:make Users

Update UsersDataTable

Update UsersDataTable class and set the columns and parameters needed to render our dataTable.

namespace App\DataTables;
use App\User;
use Yajra\DataTables\Services\DataTable;
class UsersDataTable extends DataTable
//...some default stubs deleted for simplicity.
public function html()
return $this->builder()
'dom' => 'Bfrtip',
'buttons' => ['export', 'print', 'reset', 'reload'],
protected function getColumns()
return [

Example Route:

use App\DataTables\UsersDataTable;
Route::get('users', function(UsersDataTable $dataTable) {
return $dataTable->render('users.index');

Example View:

Our users.index view located at resources/views/users/index.blade.php.

{!! $dataTable->table() !!}
<link rel="stylesheet" href="">
<script src=""></script>
<script src="/vendor/datatables/buttons.server-side.js"></script>
{!! $dataTable->scripts() !!}