ug-code/eloquent-datatable

jQuery DataTables API for elequent

v1.0.0 2019-05-16 17:36 UTC

This package is auto-updated.

Last update: 2024-09-17 09:12:43 UTC


README

Usage

Step 1: Install through composer

composer require ug-code/eloquent-datatable

Step 2: Add DataTables javascript and set it up

For more information check out the datatables manual.

var table = $('#example').DataTable({
  "processing": true,
  "serverSide": true,
  "ajax": {
    "url": "<url to datatable route>",
    "type": "POST"
  },
  "columns": [
    { data:"user_id": name:"users.user_id" },
    { data:"mail": name:"users.mail" },
    { data:"address": name:"profiles.address" },
  ]
} )
});

Step 3: PHP

$db        =Profiles::with(['users']);
echo json_encode(Datatable::make($db));