Dashboards

Dashboards are stream entries that have multiple widgets associated with it.

Dashboard Fields

Below is a list of fields in the dashboards stream. Fields are accessed as attributes:

$dashboard->name;

Same goes for decorated instances in Twig:

{{ dashboard.name }}
Fields
Key Type Description
name text The dashboard name.
slug slug The dashboard slug.
description textarea The dashboard description.
name text The dashboard name.
layout select The dashboard column layout.
allowed_roles multiple The roles allowed to view the dashboard.

Dashboard Interface

This section will go over the \Anomaly\DashboardModule\Dashboard\Contract\DashboardInterface class.

DashboardInterface::getWidgets()

The getWidgets method returns the related widgets.

Returns: \Anomaly\DashboardModule\Widget\WidgetCollection
Example
foreach ($dashboard->getWidgets() as $widget) {
    echo $widget->title . '<br>';
}
Twig
{% for widget in dashboard.getWidgets() %}
    {{ widget.title }}
{% endfor %}
DashboardInterface::widgets()

The widgets method returns the widget relation.

Returns: \Illuminate\Database\Eloquent\Relations\HasMany
Example
$widgets = $dashboard->widgets()->where('extension', 'anomaly.extension.xml_feed_widget')->get();
Twig
{% set widgets = dashboard.widgets().where('extension', 'anomaly.extension.xml_feed_widget').get() %}