PHPackages                             distilleries/datatable-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. distilleries/datatable-builder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

distilleries/datatable-builder
==============================

Based on https://github.com/chumper/datatable. It's an abstract class to implement the datatable like https://github.com/Distilleries/FormBuilder.

2.14.1(6y ago)99.5k92MITPHPPHP &gt;=7.1.3

Since Feb 11Pushed 6y ago7 watchersCompare

[ Source](https://github.com/Distilleries/DatatableBuilder)[ Packagist](https://packagist.org/packages/distilleries/datatable-builder)[ RSS](/packages/distilleries-datatable-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (43)Used By (2)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5ebe2387edc9bb9d52171b10727911c0e07556d9261a02b37ca03fcc13232c3f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44697374696c6c65726965732f446174617461626c654275696c6465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Distilleries/DatatableBuilder/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/aec6f830266f683c4baad81d8f93ee62575ea334c06ef02ee3580b24d9712b15/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44697374696c6c65726965732f446174617461626c654275696c6465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Distilleries/DatatableBuilder/?branch=master)[![Build Status](https://camo.githubusercontent.com/34056b865e247f035ae7ce8e9f82bfbb5ec78c94e50269d55e0ff3ed12c9f100/68747470733a2f2f7472617669732d63692e6f72672f44697374696c6c65726965732f446174617461626c654275696c6465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Distilleries/DatatableBuilder)[![Total Downloads](https://camo.githubusercontent.com/6f979c0ac434524b33463aef101c38a29ef6bdf4fbacbb8be35437ca209c022c/68747470733a2f2f706f7365722e707567782e6f72672f64697374696c6c65726965732f646174617461626c652d6275696c6465722f646f776e6c6f616473)](https://packagist.org/packages/distilleries/datatable-builder)[![Latest Stable Version](https://camo.githubusercontent.com/ce15cfcecde64815197e478b8fef0cc257e8473f7dd40345db0e397dd69e3188/68747470733a2f2f706f7365722e707567782e6f72672f64697374696c6c65726965732f646174617461626c652d6275696c6465722f76657273696f6e)](https://packagist.org/packages/distilleries/datatable-builder)[![License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE)

\#Laravel 5 Datatable Builder

Based on [chumper/datatable](https://github.com/chumper/datatable). It's an abstract class to implement the datatable like [the form generator](https://github.com/Distilleries/FormBuilder).

Table of contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Basic usage](#basic-usage)
3. [Closure](#closure)
4. [BaseQuery](#base-query)
5. [Filters](#filters)
6. [Styles](#styles)
7. [Controller](#controller)

\##Installation

Add on your composer.json

```
    "require": {
        "distilleries/datatable-builder": "1.*",
    }
```

run `composer update`.

Add Service provider to `config/app.php`:

```
    'providers' => [
        // ...
	   'Distilleries\FormBuilder\FormBuilderServiceProvider',
       'Distilleries\DatatableBuilder\DatatableBuilderServiceProvider',
    ]
```

And Facade (also in `config/app.php`)

```
    'aliases' => [
        // ...
		'FormBuilder'     => 'Distilleries\FormBuilder\Facades\FormBuilder',
        'Datatable'       => 'Distilleries\DatatableBuilder\Facades\DatatableBuilder',
    ]
```

Add the javascript on your bower dependencies:

```
    "dependencies": {
        "datatables": "~1.10.4",
    }
```

Export the configuration:

```
php artisan vendor:publish --provider="Distilleries\DatatableBuilder\DatatableBuilderServiceProvider"

```

Export the views (optional):

```
php artisan vendor:publish --provider="Distilleries\DatatableBuilder\DatatableBuilderServiceProvider"  --tag="views"

```

Export the Javascript assets (optional):

Include the javascript with gulp or grunt `vendor/distilleries/datatable-builder/resources/**/*`. If you don't use a task manager or you want override the javascript just publish those with the command line:

```
php artisan vendor:publish --provider="Distilleries\DatatableBuilder\DatatableBuilderServiceProvider"  --tag="assets"

```

You can find those in `resources/assets/vendor/datatable-builder`.

Basic usage
-----------

[](#basic-usage)

Creating form classes is easy. With a simple artisan command I can create a datatable:

```
php artisan datatable:make Datatables/PostDatatable
```

you create form class in path `app/Datatables/PostDatatable.php` that looks like this:

```
