Gaurav-Punjabi / spock-datatables

A laravel package to handle the server side processing of DataTables jQuery Plugin via AJAX.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spock DataTables

A laravel package to handle the server side processing of DataTables jQuery Plugin via AJAX option by using Eloquent Query Builder.

LICENSE.md LICENSE.md LICENSE.md LICENSE.md

Requirements

  • PHP >= 7.0
  • Laravel >= 5.5
  • jQuery Datatables v1.10x

Quick Installation

$ composer require fluidtech/spock-datatables

Add service provider

Register provider on you conifg\app.php file.

'providers' => [
    ...,
    \FluidTech\SpockDataTables\SpockServiceProvider::class
]

And that's it! Now you can start building out DataTables faster!

Documentation

  1. Using Eloquent Query Builder

    Fetches the and returns the records using the given query.

    Syntax

       $expectedResponse = \FluidTech\SpockDataTables\DataTable::of($query, $list_of_columns)
           ->make();
    • Accepts
      • $query : The base query from which records needs to be fetched.
      • $list_of_columns : An list of column names that needs to be displayed.
        Note : The sequence of columns should be the same as specified on the client side.

    Example

    $query = DB::table('users');
    
    return \FluidTech\SpockDataTables\DataTable::of($query, [
            "name", 
            "phone_number"
        ])
        ->make();
  2. Using Fluent Query Builder (Coming Soon)

  3. Using Collection (Coming Soon)

License

The MIT License (MIT). Please see License File for more information.

About

A laravel package to handle the server side processing of DataTables jQuery Plugin via AJAX.

License:MIT License


Languages

Language:PHP 100.0%