1. Go to this page and download the library: Download synergitech/fuel-datatables 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/ */
synergitech / fuel-datatables example snippets
class API extends Controller_Rest
{
public function get_index()
{
$datatable = \SynergiTech\DataTables\DataTable::fromGet(\Model\YourModel::class);
$datatable->setAllowedColumns([
'id',
'uuid',
'name',
'related_model.name',
'created_at',
'updated_at'
]);
return $this->response($datatable->getResponse());
}
}