2Mein / laravel-dynatable by petermein
forked from white-frame/dynatable

A facade for using the dynatable format
1,307
3
2
Package Data
Maintainer Username: petermein
Maintainer Contact: peter@2mein.nl (Peter Mein)
Package Create Date: 2015-06-03
Package Last Update: 2015-11-03
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-15 15:09:18
Package Statistics
Total Downloads: 1,307
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 3
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

#Work had resumed on the original Ifnot library now called White-frame so this is deprecated.

Laravel Dynatable for Laravel 5

A library for sending connecting to the dynatables.js front end.

Credits to ifnot for making the original version of dynatables for laravel.

Installation

composer require twomein/laravel-dynatables

Usage

Register the service provider in the app.config

'Twomein\LaravelDynatable\LaravelDynatableServiceProvider',

Example usage:


    //Get an Eloquent collection
    $cars = Car::all();
    
    //Define the columns you want to send
    $columns = ['id', 'name', 'price', 'stock'];
    
    // Build dynatable response
    return Dynatable::make($cars, $columns, Input::all());
  }
}

Inputs

To give a little bit of insights about the inputs parameter:

'page-length' => (int)$inputs['perPage'],
'page-number' => (int)$inputs['page'],
'offset' => (int)$inputs['offset'],
'sorts' => isset($inputs['sorts']) ? $inputs['sorts'] : null,
'search' => isset($inputs['queries']['search']) ? $inputs['queries']['search'] : null,