PHPackages                             bitstudio-id/bitdatatable - 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. [Database &amp; ORM](/categories/database)
4. /
5. bitstudio-id/bitdatatable

ActiveLibrary[Database &amp; ORM](/categories/database)

bitstudio-id/bitdatatable
=========================

A simple way to implement datatable with query builder

1.0.9(10mo ago)62366MITPHPPHP &gt;=5.6.4

Since Aug 26Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/bitstudio-id/BITDataTable)[ Packagist](https://packagist.org/packages/bitstudio-id/bitdatatable)[ RSS](/packages/bitstudio-id-bitdatatable/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

BITDataTable : jQuery DataTables for Laravel
============================================

[](#bitdatatable--jquery-datatables-for-laravel)

This package is created to handle server-side works of DataTables jQuery Plugin via AJAX option by using Eloquent ORM / Query Builder.

Quick Installation
------------------

[](#quick-installation)

```
composer require bitstudio-id/bitdatatable

```

Requirements
------------

[](#requirements)

- [PHP &gt;= 5.6.4](http://php.net/)
- [Laravel &gt;= 5.4](https://github.com/laravel/framework)
- [jQuery DataTables v1.10.x](http://datatables.net/)

Javascript and CSS
------------------

[](#javascript-and-css)

```

```

Blade view
----------

[](#blade-view)

```

      #ID
      Name
      Role
      Email
      ...

```

Javascript
----------

[](#javascript)

```

  $(document).ready(function () {
    //hide error/warning on datatable
    $.fn.dataTable.ext.errMode = 'none';

    var table = $('#table').DataTable({
      //enable filter

      bFilter: true,
      processing: true,
      serverSide: true,
      ajax: {
        url: "/dummy/dtb-v2/get",
        type: 'get',
      },
      columns: [
        {data: "id", name: "id", searchable: false, orderable: false},
        {data: "employee.code"},
        {data: "name", name: "user_name"},
        {data: "employee.role.name"},
        {data: "email"},
        {data: "action", searchable: false, orderable: false}, // use searchable: false, orderable: false for custom column
      ],
    });
  });

```

How to use with eloquent
------------------------

[](#how-to-use-with-eloquent)

```
use BITStudio\BITDataTable\BITDataTable;
...
...
public function dtbGetV2(Request $request)
{
  $dtb = new BITDataTable();

  // Set request
  $dtb->setRequest($request);

  $user = User::query()->with('employee', 'employee.role');

  $dtb->from($user);

  $state = "admin";

  $dtb->addCol(function ($user){
    $user->action = "action-{$item->id}";
    return $user;
  });

  return $dtb->generate();
}
```

How to use logic on addCol
--------------------------

[](#how-to-use-logic-on-addcol)

```
$state = "admin";

$dtb->addCol(function ($user) use ($state){
  //use logic on addCol

  //set as empty default
  $user->admin_col = "";

  if($state == $user->role->name) {
      $user->admin_col .= "admin-col";
  }
   return $user;
});

```

How to use with Query Builder
-----------------------------

[](#how-to-use-with-query-builder)

```
use BITStudio\BITDataTable\BITDataTable;
...
...
public function dtbGetV2(Request $request)
  $dtb = new BITDataTable();

  $dtb->setRequest($request);

  $q = DB::table("orders as o");
  $q->select("o.*", "o.no_cs as customer_number", "e.employee_name as emp_name");
  $q->leftJoin("employee as e", "e.id", "=", "o.employee_id");

  $dtb->from($q);

  //add custom column
  $dtb->addCol(function ($user){
    $user->action = "action-{$item->id}";

    return $user;
  });

  return $dtb->generate();
}
```

### How to show index number for numbering on view

[](#how-to-show-index-number-for-numbering-on-view)

```
$dtb->setRowIndex(true);

```

this will append property DT\_RowIndex on json response

```
columns: [
        {data: "DT_RowIndex", name: "id" searchable: false, orderable: false},
        ...
        ]

```

dont forget to set searchable = false

#### add value class attribute

[](#add-value-class-attribute)

```
$dtb->addClass("text-danger"); //insert before genereate

```

#### add value id attribute

[](#add-value-id-attribute)

```
//create custom from collection property
$dtb->setRowId("id");

//create custom from addCol or setRowId for custom id attribute
$dtb->setRowId(function($item) {
    $item->DT_RowId = "id-".$item->id;
    return $item;
});

```

License
-------

[](#license)

The MIT License (MIT). Please see License File for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance54

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~429 days

Recently: every ~531 days

Total

6

Last Release

305d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1d7834c4d018cf15fa7b9ab0e4d944ddeccb4d7b1cc2a0611ccf975c507d5fe?d=identicon)[ibnuul](/maintainers/ibnuul)

---

Top Contributors

[![cacing69](https://avatars.githubusercontent.com/u/36250619?v=4)](https://github.com/cacing69 "cacing69 (18 commits)")[![salihinlandrex](https://avatars.githubusercontent.com/u/52810908?v=4)](https://github.com/salihinlandrex "salihinlandrex (2 commits)")[![mtriwardanaa](https://avatars.githubusercontent.com/u/53548082?v=4)](https://github.com/mtriwardanaa "mtriwardanaa (1 commits)")

---

Tags

datatableeloquentjavascriptjquery-datatableslaravelphpquery-builder

### Embed Badge

![Health badge](/badges/bitstudio-id-bitdatatable/health.svg)

```
[![Health](https://phpackages.com/badges/bitstudio-id-bitdatatable/health.svg)](https://phpackages.com/packages/bitstudio-id-bitdatatable)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
