Download the PHP package livecms/datatables without Composer
On this page you can find all versions of the php package livecms/datatables. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download livecms/datatables
More information about livecms/datatables
Files in livecms/datatables
Package datatables
Short Description Live CMS Datatables
License MIT
Homepage https://github.com/mrofi/livecms-datatables
Informations about the package datatables
Welcome to LiveCMS DataTables For Laravel 5.5 or above
What is ?
This package can deal with Javascript DataTables.
Features
- Full Yajra DataTables features with some improvements. See documentation
Notes
- Please add DataTables js and css, see DataTables Documentation
How to use?
Install via composer
Publish config file :
Edit 'datatables.php' config file.
DataTables Class
Definition :
DataTables(LiveCMS\DataTables\HasDataTables $object, $url, array $fields = null)
Define Base Query
You can create a new class or use existing one.
What you need to do is implement interface LiveCMS\DataTables\HasDataTables
and create a method : toDataTablesQuery()
This method must return a Laravel Query Builder, Relation, Collection or API Resource Collection
Define Fields
Fields defined by array.
Example :
You have fields : id, name, is_active, action
which are id, name and is_active
is in your model data and action
field is a custom field that contains action buttons : Edit and Delete
button
Then your fields would be like this and the explanation is in the bellow :
You can place fields in method : getDataTablesFields()
in class that implement HasDataTables
interface, i.e.
or in third parameter when you call DataTables class. See definition
Field Definition Explaination :
Every single field in the array automatically will be converted into this default form :
-
Field exists in database
- Field doesn't exist in database or custom field
Notes : Don't forget use class \Illuminate\Support\HtmlString
to un-escape the html code
Let's play
Controller :
View :
file : admin/sports/index.blade.php
LICENSE
MIT
CONTRIBUTING
Fork this repo and make a pull request
ISSUE AND DISCUSSION
Please create new issue or see the closed issues too.
All versions of datatables with dependencies
illuminate/contracts Version 5.4.*|5.5.*|5.6.*
illuminate/support Version 5.4.*|5.5.*|5.6.*
yajra/laravel-datatables-oracle Version ~8.0