zgabievi/kendo-grid-state

Helper package to handle kendo grid state in Laravel

0.1.0 2018-08-13 06:36 UTC

This package is auto-updated.

Last update: 2024-10-29 04:14:50 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

Do you love to use Kendo Grid on your website? Have you ever tried to manage it's state to return correct data? With the help of this package, it will only take you several seconds now. You just need to install our helper, and tell us on which model should it work... Done!

Installation

Install via composer

composer require zgabievi/kendo-grid-state

Usage

To use this package you only need to add Filterable trait to your model

Example:

 namespace App;
 
 use Illuminate\Database\Eloquent\Model;
 use Zgabievi\KendoGridState\Traits\Filterable;
 
 class Post extends Model
 {
     use Filterable;
     
     //
 }

URL Examples:

  • https://domain.com/api/posts?take=5
  • https://domain.com/api/posts?skip=5&take=2
  • https://domain.com/api/posts?sort[0][field]=title&sort[0][dir]=desc
  • https://domain.com/api/posts?filter[logic]=and&filter[filters][0][field]=title&filter[filters][0][operator]=eq&filter[filters][0][value]=POST_TITLE

Query Parameters:

  • filter?
    • filters[]
      • field? (string | Function)
      • ignoreCase? (boolean)
      • operator ("eq", "neq", "isnull", "isnotnull", "lt", "lte", "gt", "gte", "startswith", "endswith", "contains", "doesnotcontain", "isempty", "isnotempty")
      • value? (any)
    • logic ("or", "and")
  • group?[]
    • aggregates?[]
      • aggregate ("count", "sum", "average", "min", "max")
      • field (string)
    • dir? ("asc", "desc")
    • field (string)
  • skip? (number)
  • sort?
    • dir? ("asc", "desc")
    • field (string)
  • take? (number)

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email zura.gabievi@gmail.com instead of using the issue tracker.

Credits

License

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