amirsadjad/simple-list-formatter
Composer 安装命令:
composer require amirsadjad/simple-list-formatter
包简介
Simple list formatter for UI development ease of use.
README 文档
README
Simple list formatter for UI development ease of use.
This id a package to format your collections of data based on the UI needs. You can format "laravel collection", "eloquent collection" and "array". you can create a preset for every page of your application in the database and then just pass the data and preset to the facade and get the parsed result with desired columns, with sortability, searchability and dynamic paging. you can also pass metadata to the preset and it will be delivered to UI with the resultint list.
For installation run:
composer require amirsadjad/simple-list-formatter
then publish the config file by running:
php artisan vendor:publish --tag=simple-list-formatter-config
to migrate the table run:
php artisan migrate
Basic Usage:
use Amirsadjad\SimpleListFormatter\Facades\SimpleList; // you need to start by using the function Of() $list = SimpleList::Of($data, $preset); // you can chain other methods $list->search($query); $list->sortBy($columnName, false); $list->pageNumber($pageNumber); // you have to run the generate() at the end to parse the data $list->generate()
To interacting with presets table you can either use the Model class
SimpleListPresets::find($name); // preset data needs to be formatted like this $preset = [ 'columns' => [ 'column_name' => [ 'data_type' => 'string', 'is_sortable' => 'bool', 'is_searchable' => 'bool', 'width' => 'int', 'title' => 'string', 'metadata' => 'array' ], ... .. . ], 'page_size' => 'int', ];
Or you can use the built in APIs: https://www.getpostman.com/collections/64bcf64f6a05fc87cc8b
You can see an example of how to use this package in a project here: https://github.com/Amirsadjad/simple-list-formatter-example
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-16