bewarhizirvan / laravel-grid
A Grid Table Generator for Laravel
Requires
- php: ^7.1|^7.4|^8.0|^8.1.0
- illuminate/support: ~5|~6|~7|~8|~9
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3|~4
- phpunit/phpunit: ^8.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2024-12-18 16:14:23 UTC
README
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.