42sol / laravel-vxe-controller
v1.0-rc.5
2023-05-03 13:52 UTC
Requires
- laravel/framework: >=8.0
README
VxeController is designed to fast start working with VxeTable table component.
Features:
- Data item query
- Data items listing
- Data items pagination
- Filtering
Usage
Server side
To start working make these steps:
-
Create controller for model
// app\Http\Controller\DocumentController.php use App\Models\Document; use VxeController\Http\Controller\VxeController; class DocumentController extends VxeController { function model() { return Document::class; } }
-
Register routes for controller:
- manually
- with simple
Route::vxeController
method for development purpose// routes/web.php Route::vxeController(\App\Http\Controllers\DocumentController::class);
Routes will be registered:/document
- [GET, POST] - list model items/document/update
- [POST] - update item/document/destroy
- [POST] - remove item
Methods query params
Listing
Client side
Using filters
const filters = $vxeTable.getCheckedFilters().reduce((acc, cur) => { acc[cur.property] = { datas: cur.datas, values: cur.values }; return acc; }, {});