Laravel 中的动态报告生成
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33542961/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Dynamic Reports Generation in laravel
提问by Gowtham Selvaraj
I'm trying to develop a custom reports generation for my application, in which the user will dynamically input the model and its related model.And will select the related columns for which the report is needed and will have conditional statements for 'AND' and 'OR' conditions.
我正在尝试为我的应用程序开发自定义报告生成,其中用户将动态输入模型及其相关模型。并将选择需要报告的相关列,并将具有“AND”和“或”条件。
The same functionality is done is vtiger ,Zoho CRM and sales force .
相同的功能是vtiger、Zoho CRM 和销售团队。
My doubt is which is the efficient way of doing it.
我的疑问是哪种方法是有效的。
1.Either by creating tables for each modules and defining its column in database 2.Or by providing a config file for all the set up 3.Or by creating a model class for all reports and defining its related model attributes and binding data using getter and setter(accessors and mutators). 4.Or suggest me any other preferrable method or any packages with have minimal functionalities relating this
1. 为每个模块创建表并在数据库中定义其列 2. 或为所有设置提供配置文件 3. 或为所有报告创建模型类并使用 getter 定义其相关模型属性和绑定数据和 setter(访问器和修改器)。4.或建议我任何其他更可取的方法或任何与此相关的功能最少的软件包
I know is complex but please suggest me few hints from your point of view.
我知道这很复杂,但请从您的角度给我一些提示。
回答by shivanka perera
you can use a Querybuilder to generate queries by users themselves. then use something similar to JSReport to allow users to design reports. There are very good web report designers out there, but most of them are for a price. if you still wanna make your own, refer these; Seal reports JSReports for reference what you looking for is real ;-)
您可以使用 Querybuilder 由用户自己生成查询。然后使用类似于 JSReport 的东西来允许用户设计报告。那里有非常好的 Web 报告设计器,但其中大多数都是有价的。如果你还想自己做,参考这些;Seal 报告 JSReports 以供参考,您正在寻找的是真实的 ;-)
use JQueryQueryBuilder and customize according to your need. use Laravel Boilerplate or something to start-off with. use Handlebars.js / Mustache.js or Blade as the template engine. be creative...
使用 JQueryQueryBuilder 并根据您的需要进行自定义。使用 Laravel Boilerplate 或其他东西来开始。使用 Handlebars.js / Mustache.js 或 Blade 作为模板引擎。有创意...
cheers!!!
干杯!!!
回答by Kartikey Tanna
For similar requirement, I have come across Reportico
对于类似的要求,我遇到了Reportico
Though I have not started implementing it yet, but it seems really nice.
虽然我还没有开始实施它,但它看起来真的很好。
They have Laravel module as well, supporting Laravel 5.1
他们也有 Laravel 模块,支持 Laravel 5.1
Seems the team keeps the thing updated.
似乎团队保持更新。
Although their UI is not good, they have got report builder as well.
虽然他们的用户界面不好,但他们也有报告生成器。
Their Github link: https://github.com/reportico-web/
他们的 Github 链接:https: //github.com/reportico-web/
回答by Angad Dubey
Although not a complete solution, I think this can help you on your way to creating your own:
虽然不是一个完整的解决方案,但我认为这可以帮助您创建自己的解决方案:
You can get all your tables from your DB dynamically:
DB::select('SHOW TABLES');
You can get column names for tables as well:
Schema::getColumnListing('users');
Try an find a way to get related tables to the one the users selects.
get intended query from user form. ( with conditions and value )
profit.
您可以动态地从数据库中获取所有表:
DB::select('SHOW TABLES');
您也可以获取表的列名:
Schema::getColumnListing('users');
尝试找到一种方法将相关表与用户选择的表相关联。
从用户表单中获取预期查询。(有条件和价值)
利润。