Contents

backend.dash.extendReports

Triggered in Dashboard\Widgets\Dash.

Called after the dash reports are defined

Example usage:

Event::listen('backend.dash.extendReports', function ((\Dashboard\Widgets\Dash) $widget) {
    // Only for the User controller
    if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) {
        return;
    }

    // Only for the User model
    if (!$widget->model instanceof \RainLab\User\Models\User) {
        return;
    }

    // Add an extra birthday report
    $widget->addReports([
        'birthday' => [
            'label'   => 'Birthday',
            'type'    => 'datepicker'
        ]
    ]);

    // Remove a Surname report
    $widget->removeReport('surname');
});

Or

$dashWidget->bindEvent('dash.extendReports', function () use ((\Dashboard\Widgets\Dash $dashWidget)) {
    // Only for the User controller
    if (!$widget->getController() instanceof \RainLab\User\Controllers\Users) {
        return;
    }

    // Only for the User model
    if (!$widget->model instanceof \RainLab\User\Models\User) {
        return;
    }

    // Add an extra birthday report
    $widget->addReports([
        'birthday' => [
            'label'   => 'Birthday',
            'type'    => 'datepicker'
        ]
    ]);

    // Remove a Surname report
    $widget->removeReport('surname');
});