Package Data | |
---|---|
Maintainer Username: | jmarkese |
Maintainer Contact: | john.markese@gmail.com (John Markese) |
Package Create Date: | 2017-03-09 |
Package Last Update: | 2017-08-25 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-01-25 15:23:40 |
Package Statistics | |
---|---|
Total Downloads: | 26 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 5 |
Total Watchers: | 2 |
Total Forks: | 2 |
Total Open Issues: | 0 |
A package for Laravel that integrates Eloquent queries and Illuminate Collections into Datatables for JQuery.
src/
Via Composer
$ composer require markese/datatables
// Laravel:
namespace App\Http\Controllers;
use Markese\Datatables\Datatables;
class Controller extends BaseController
{
public function datatablesExample (Request $request)
{
$users = Users::query();
return Datatables::response($users, $request);
}
}
// Datatables:
$('#example').DataTable( {
"serverSide": true,
"processing": true,
"ajax": "datatablesexample",
columns : [
// The "name" property in the column initialization for Model attributes are optional.
// This works...
{ "data": "id", "title": "Id" },
// And so does this...
{ "data": "name", "title": "Name", "name": "name" },
{ "data": "email", "title": "Number", "name": "email" },
// The "name" properties in your Datatables column initialization
// will eager load the relations of the Model you are querying against
// when you use Laravel dot notation...
{ "data": "groups[].name", "title": "Groups", "name": "groups.*.name" },
// The "data" properties in the column initialization represent the displayed data
// which is accessible using standard JavaScript bracket notation...
{ "data": "groups[].roles[].title", "title": "Roles", "name": "groups.*.roles.*.title" }
]
} );
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email john.markese@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.