-
Notifications
You must be signed in to change notification settings - Fork 8
Home
Welcome to the Laravel Dynamic Report Generator wiki! This package allows users to create, save, and execute custom SQL queries dynamically from the browser. Below you'll find documentation to help you get started.
Install the package via Composer:
composer require devforest/laravel-dynamic-report-generator
Add the ReportGeneratorServiceProvider
to your config/app.php
file:
'providers' => [
// ...
DevForest\ReportGeneratorServiceProvider::class,
],
Publish the required assets:
php artisan vendor:publish --provider="DevForest\ReportGeneratorServiceProvider" --tag=migrations
php artisan vendor:publish --provider="DevForest\ReportGeneratorServiceProvider" --tag=public
Run the migrations to create the necessary database tables:
php artisan migrate
No additional configuration is required out of the box. The package uses Laravel's default database and routing configurations.
Once installed, you can access the report generator interface at:
http://your-app-url/report-generator
- Navigate to the report generator interface.
- Enter the SQL query you wish to execute (note that dangerous queries like
CREATE
,ALTER
,TRUNCATE
,DROP
,INSERT
,UPDATE
, andDELETE
are prohibited). - Provide a name for your report.
- Click the "Save" button to save the report.
To view the list of saved reports, navigate to:
http://your-app-url/report-generator/reports
- From the list of reports, click on the report you wish to execute.
- The results will be displayed in a paginated format.
- You can navigate through the pages to view all results.
This package uses the ShareErrorsFromSessionMiddleware
middleware to handle session errors. It is aliased as share.errors
in your routes.
The package loads its routes from the routes/web.php
file. Below are the key routes used:
-
GET /report-generator
: Display the report generator interface. -
POST /report-generator/save
: Save a new report. -
GET /report-generator/reports
: List all saved reports. -
GET /report-generator/execute/{slug}
: Execute a saved report. -
GET /report-generator/get-columns/{table}
: Get columns and foreign keys of a table.
- index: Displays the report generator interface.
- save: Validates and saves a new report.
- listReports: Lists all saved reports.
- execute: Executes a saved report with pagination.
- getColumns: Retrieves columns and foreign keys of a specified table.
The package's views are located in resources/views/vendor/laravel-dynamic-report-generator
. The key views are:
-
index.blade.php
: Main interface for creating reports. -
reports.blade.php
: Lists all saved reports. -
result.blade.php
: Displays the results of an executed report.
Feel free to explore and customize these views to fit your application's needs.
The Laravel Dynamic Report Generator is a powerful tool for dynamically creating and executing SQL queries from the browser. For any issues or contributions, please refer to the GitHub repository. Happy reporting!