Contents

backend.dash.extendReportsBefore

Triggered in Dashboard\Widgets\Dash.

Called before the dash reports are defined

Example usage:

Event::listen('backend.dash.extendReportsBefore', function ((\Dashboard\Widgets\Dash) $widget) {
    // You should always check to see if you're extending correct model/controller
    if (!$widget->model instanceof \Foo\Example\Models\Bar) {
        return;
    }

    // Add a new report named example_report
    $widget->addReport('example_report', [
        'label' => 'Example report',
        'type' => 'text'
    ]);
});

Or

$dashWidget->bindEvent('dash.extendReportsBefore', function () use ((\Dashboard\Widgets\Dash $dashWidget)) {
    // You should always check to see if you're extending correct model/controller
    if (!$widget->model instanceof \Foo\Example\Models\Bar) {
        return;
    }

    // Add a new report named example_report
    $widget->addReport('example_report', [
        'label' => 'Example report',
        'type' => 'text'
    ]);
});