hello, i have interesting topic
i need to prepare dynamic report, frontend will send me request with details about data i should return and i want to return object ready to paste to generic table
stack: lumen/vuejs
how it should works? (Simple example)
as user i want to see all workplaces with all data, and workplaces assigned to them, but only with id and name
whats the problem?
frontend should give me fields that he want to see, and i should return him obiect with record, im looking for good or the best approach to achieve it
report can contain nested data, example (for now) request from frontend:
example report: reports/users
{
"columns": [
"x",
"y"
],
"appends": [
{
"user": {
"columns": [
"x",
"y"
]
}
}
]
}```
the current approach is prepare endpoint for few reports: users, workplaces....
in current build its easy to just make select and join relations, but i have a lot of pivots here, for example workplace can have devices - ok, im displaying devices, but because of its fully dynamic i cant use api resources (maybe im wrong), and problem appear when i have model_id in device, i want to display model: "string" (based on relation, model_id), the report can contain a lot of nested obiects, maybe i started plan of wrong side...what do you think? maybe i should return data with needed relations and frontend will display that it need base on headings?