{"id":22916657,"url":"https://github.com/synergitech/fuel-datatables","last_synced_at":"2025-04-01T12:44:23.434Z","repository":{"id":52452826,"uuid":"159200108","full_name":"SynergiTech/fuel-datatables","owner":"SynergiTech","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-28T21:46:11.000Z","size":23,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T07:41:30.606Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SynergiTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-26T16:32:51.000Z","updated_at":"2020-04-29T08:55:15.000Z","dependencies_parsed_at":"2022-09-18T03:42:48.140Z","dependency_job_id":null,"html_url":"https://github.com/SynergiTech/fuel-datatables","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SynergiTech%2Ffuel-datatables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SynergiTech%2Ffuel-datatables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SynergiTech%2Ffuel-datatables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SynergiTech%2Ffuel-datatables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SynergiTech","download_url":"https://codeload.github.com/SynergiTech/fuel-datatables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246642172,"owners_count":20810556,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T06:14:08.888Z","updated_at":"2025-04-01T12:44:23.395Z","avatar_url":"https://github.com/SynergiTech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FuelPHP DataTables\n![Build status](https://api.travis-ci.org/SynergiTech/fuel-datatables.svg?branch=master)\n\nImplement DataTables with FuelPHP's ORM\n\n## Installation\n\n```\n$ composer require synergitech/fuel-datatables\n```\n\n## Basic Usage\n\nYou need to call the `setAllowedColumns()` function to define which columns can be accessed and returned.\n\n```php\nclass API extends Controller_Rest\n{\n  public function get_index()\n  {\n      $datatable = \\SynergiTech\\DataTables\\DataTable::fromGet(\\Model\\YourModel::class);\n      $datatable-\u003esetAllowedColumns([\n         'id',\n         'uuid',\n         'name',\n         'related_model.name',\n         'created_at',\n         'updated_at'\n      ]);\n\n      return $this-\u003eresponse($datatable-\u003egetResponse());\n  }\n}\n```\n\n### Customize query\n\nIf you wish to do more complex ORM queries, you can simply call the `getQuery()` function which will return the FuelPHP ORM's query object, which you can then manipulate as you need to.\n\n```php\n$datatable-\u003egetQuery()\n   -\u003ewhere('id', \"\u003e\", 0)\n   -\u003erelated(\"group\")\n   -\u003ewhere(\"group.name\", \"!=\", \"guests\")\n   -\u003erelated(\"another_relation\");\n```\n\n### Row formatters\n\nYou can provide custom callbacks that will be executed for each row to be returned in the response. You can use this to manipulate each row in the response.\n```php\n$datatable-\u003eaddRowFormatter(function ($model, $outputRow) {\n    $outputRow['example'] = count($model-\u003ea_many_relation);\n    return $outputRow;\n});\n```\n\n### XSS filtering\n\nTo make it easier for you to manage filtering your output, you can ask for all or specific rows to be encoded on output.\nBy default, we leave XSS filtering up to you.\n\n#### Escape all columns\n```php\n$datatable-\u003esetEscapedColumns();\n```\nWith exceptions:\n```php\n$datatable-\u003esetEscapedColumns()\n    -\u003esetRawColumns(['html_body']);\n```\n\n#### Escape some columns\n```php\n$datatable-\u003esetEscapedColumns(['id', 'slug']);\n```\n\n#### Turn off escaping\n```php\n$datatable-\u003esetEscapedColumns([]);\n```\n\n### Pre-requisites\n\n* [FuelPHP ORM (SynergiTech Fork)](https://github.com/SynergiTech/fuel-orm)\n* jQuery\n* DataTables\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynergitech%2Ffuel-datatables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynergitech%2Ffuel-datatables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynergitech%2Ffuel-datatables/lists"}