Download the PHP package macropay-solutions/laravel-crud-wizard-decorator-free without Composer
On this page you can find all versions of the php package macropay-solutions/laravel-crud-wizard-decorator-free. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macropay-solutions/laravel-crud-wizard-decorator-free
More information about macropay-solutions/laravel-crud-wizard-decorator-free
Files in macropay-solutions/laravel-crud-wizard-decorator-free
Package laravel-crud-wizard-decorator-free
Short Description Data composition/decoration for laravel-crud-wizard-free library including url query language
License MIT
Informations about the package laravel-crud-wizard-decorator-free
laravel-crud-wizard-decorator-free - MaravelQL
This is a stripped down version of laravel-lumen-crud-wizard-decorator
and can be used for calling laravel-crud-wizard-free
It renames/maps the column names for the resource and its relations.
The reserved words / parameters that will be used as query params are:
- perPage
- page
The query params will be disregarded
I. Install
II. Start using it
III. Crud routes
III.1. Create resource
III.2. Get resource
III.3. List filtered resource
III.4. Update resource (or create)
III.5. Delete resource
I. Install
composer require macropay-solutions/laravel-crud-wizard-decorator-free
II. Start using it
Register your middleware decorators as route middleware for each resource:
OBS.
- The query params will be disregarded. These are to be used only internally with undecorated request.
- 202 http response code will not be decorated, and it can be used to send messaged to FE. Example: {"message":"Accepted"}
- 204 http response will be decorated as empty body.
Use the middleware alias as middleware in your crud route definition for each method
Example:
See also Laravel crud wizard decorator demo
III. Crud routes
III.1 Create resource
POST /{resource}
headers:
Authorization: Bearer ... // if needed. not coded in this lib
Accept: application/json
ContentType: application/json
body:
{
"roleID": "1",
}
Json Response:
200:
{
"success": true,
"code": 201,
"locale": "en",
"message": "success",
"data": {
"ID": 3,
"roleID": "1",
"updatedAt": "2022-10-27 09:05:49",
"createdAt": "2022-10-27 09:04:46",
"pki": "3"
}
}
{
"success": false,
"code": 400,
"locale": "en",
"message": "The given data was invalid: The role id field is required.",
"data": {
"roleID": [
"The role id field is required."
]
}
}
III.2 Get resource
GET /{resource}/{identifier}
GET /{resource}/{identifier}/{relation}/{relatedIdentifier}
headers:
Authorization: Bearer ... // if needed. not coded in this lib
Accept: application/json
Json Response:
200:
{
"success": true,
"code": 200,
"locale": "en",
"message": "success",
"data": {
"ID": 3,
"roleID": "1",
"updatedAt": "2022-10-27 09:05:49",
"createdAt": "2022-10-27 09:04:46",
"roleRelationName": "name",
"roleRelationColor": "blue",
"pki": "3"
}
}
{
"success": false,
"code": 400,
"locale": "en",
"message": "Not found",
"data": null
}
III.3 List filtered resource
GET /{resource}?perPage=10&page=2
GET /{resource}/{identifier}/{relation}?... // paid version only
headers:
Authorization: Bearer ... // if needed. not coded in this lib
Accept: application/json or application/xls
The xls will contain undecorated columns and needs special access. See AbstractDecoratorMiddleware::isUserAllowedToDownloadXls
Json Response:
200:
{
"success": true,
"code": 200,
"locale": "en",
"message": "success",
"data": {
"current_page": 1,
"data": [
{
"ID": 3,
"roleID": "1",
"updatedAt": "2022-10-27 09:05:49",
"createdAt": "2022-10-27 09:04:46",
"roleRelationName": "name",
"roleRelationColor": "blue",
"pki": "3"
}
],
"from": 1,
"last_page": 1,
"per_page": 10,
"to": 1,
"total": 1,
"filterable": [
"ID",
"roleID",
"updatedAt",
"createdAt",
],
"sortable": [
"ID",
"roleID"
]
}
}
Binary response for application/xls
III.4 Update resource (or create)
PUT /{resource}/{identifier}
PUT /{resource}/{identifier}/{relation}/{relatedIdentifier}
headers:
Authorization: Bearer ... // if needed. not coded in this lib
Accept: application/json
ContentType: application/json
body:
{
"roleID": "2"
}
Json Response:
200:
{
"success": true,
"code": 200, // or 201 for upsert
"locale": "en",
"message": "success",
"data": {
"ID": 3,
"roleID": "2",
"updatedAt": "2022-10-27 09:05:49",
"createdAt": "2022-10-27 09:04:46",
"pki": "3"
}
}
{
"success": false,
"code": 400,
"locale": "en",
"message": "The given data was invalid: The role id field is required.",
"data": {
"roleID": [
"The role id field is required."
]
}
}
In case of validation errors, only the keys from data object will be decorated!
III.5 Delete resource
DELETE /{resource}/{identifier}
DELETE /{resource}/{identifier}/{relation}/{relatedIdentifier}
headers:
Authorization: Bearer ... // if needed. not coded in this lib
Accept: application/json
Json Response:
200:
{
"success": true,
"code": 204,
"locale": "en",
"message": "success",
"data": null
}
{
"success": false,
"code": 400,
"locale": "en",
"message": "Not found",
"data": null
}
All versions of laravel-crud-wizard-decorator-free with dependencies
ext-json Version *
macropay-solutions/laravel-crud-wizard-free Version ^3.4.18 || ^4.0.0