bewarhizirvan/laravel-grid

A Grid Table Generator for Laravel

0.91 2022-09-28 05:47 UTC

This package is auto-updated.

Last update: 2024-04-21 10:27:33 UTC


README

Latest Version on Packagist Total Downloads Build Status StyleCI

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require bewarhizirvan/laravel-grid

Usage

For initiating new grid

$grid = new \BewarHizirvan\LaravelGrid\LaravelGrid($parameters);

$parameters must be an array and is optional, all keys are optional

checkClass : Authorization Class must have can() function
paginate : Rows per Page (default: 50)
provider : Model
dir : Grid direction { right, left (default) }
label : Label at the top of Grid
label_extra : Extra Info below Label
counterString : Counter String ( default: Showing records %s — %s of %s )
headerCounter : Enable/Disable Header Counter ( default: true)
footerCounter : Enable/Disable Footer Counter ( default: true)

Functions

$grid->setProvider($provider);  
$grid->setLabelButton($label = 'New', $route = '');
$grid->orderBy($col,$dir);
$grid->setTotal($count);
$grid->setIPsortable($name);
$grid->addColumn($name = 'id', $label = 'id',$filter = false, $sortable = false, $ValueCalculator = null, $ValueFormatter = null);
$grid->addFilter($name = 'id', $label = 'id', $operator = 'like', $options = null);
$grid->addFilterSelect($name = 'id', $label = 'id', $options = []);
$grid->addActionColumn($col = 'id', $active = false, $inverse = false);
$grid->addActionButton($type = 'default', $title='', $route = '/', $conditions = [], $colid = null);

When finished do bellow

$grid = $grid->render();

the above step will generate an html code

Static Function

\BewarHizirvan\LaravelGrid\LaravelGrid::addContextMenu($value = '', $title = ['name'=>'','value'=>''], $rows = [], $right=false);

Constants

\BewarHizirvan\LaravelGrid\LaravelGrid::PARENT;
\BewarHizirvan\LaravelGrid\LaravelGrid::SUBMENU;
\BewarHizirvan\LaravelGrid\LaravelGrid::OK;
\BewarHizirvan\LaravelGrid\LaravelGrid::NOTOK;
\BewarHizirvan\LaravelGrid\LaravelGrid::ENABLED;
\BewarHizirvan\LaravelGrid\LaravelGrid::DISABLED;

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Credits

License

MIT. Please see the license file for more information.