Laravel Report package

Installs: 5 889

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 5

Forks: 6

Open Issues: 4

Type:package


README

Laravel Report Build

Import Laravel Reporting into any Laravel 6+ application using this package.

Installation

Install Laravel Report with composer.

php composer require mblsolutions/report

Copy the package config to your local config.

php artisan vendor:publish --tag=report-config

Copy the package database migrations.

php artisan vendor:publish --tag=report-migrations

Laravel Report comes with its own database migrations, once the package has been installed run the migrations.

php artisan migrate

Usage

Once the package has been required into your project you can configure which parts of the package you would like to use.

Routes

To enable the package json api routes in your application add the following to your routes file.

Report::routes();

Manage routes

To configure custom middleware/guards around report management/creation only routes.

Report::manageRoutes();

View Routes

To configure custom middleware/guards around report view only routes.

Report::viewRoutes();

Export Routes

To configure custom middleware/guards around report export result only routes.

Report::exportRoutes();

Applying Custom Middleware/Gates

To apply middleware to the routes, wrap the routes in middleware groups.

Route::middleware(['admin'])->group(function () {
    Report::manageRoutes();
});

Route::middleware(['user'])->group(function () {
    Report::viewRoutes();
});

Route::middleware(['web'])->group(function () {
    Report::exportRoutes();
});

To apply gates to the routes, wrap the routes in middleware groups.

Route::middleware(['can:manage-reports'])->group(function () {
    Report::manageRoutes();
});

Route::middleware(['can:view-reports'])->group(function () {
    Report::viewRoutes();
});

Report Select Parameter Models

To enable select options when creating/rendering reports, you must add the available model types to be reported on in the report.php config file. Any models added to this array will be available when creating new report fields.

Models added to the array should implement the \MBLSolutions\Report\Interfaces\PopulatesReportOption interface

Please Note: We recommend that large record sets are not used as select types, due to usability/browser performance issues.

[
    'models' => [
        \App\User::class,
        \App\Order::class
    ]
]

Scheduled Reporting

To enable scheduled reporting add the following line into the schedule method of the \App\Console\Kernel file of your laravel application.

$schedule->command(\MBLSolutions\Report\Console\Commands\DispatchScheduledReportsCommand::class)->hourly();

Report JSON API

The following endpoints are available to you once the routes have been added:

View Routes (synchronous)

Queued View Routes (asynchronous)

Scheduled Report Routes

Export Routes

Manage Routes

Report Events

Events are fired at critical points during report creation/completion