SeviaFlow Get Started

UI: Dashboard

The UI package provides the default dashboard and lets an application register custom dashboards made from SeviaFlow widgets. A dashboard is a class with a stable slug, a label, and a list of widgets. You can keep the default dashboard or add a custom one for an operator group.

Register a simple dashboard

This example displays a count of customers. StatsWidget::count() uses the Resource's base query and returns zero when the current user cannot view that Resource.

namespace App\SeviaFlow\Dashboards;

use App\SeviaFlow\Resources\CustomerResource;
use SeviaFlow\Ui\Dashboard\Dashboard;
use SeviaFlow\Ui\Dashboard\Widgets\StatsWidget;

final class OperationsDashboard extends Dashboard
{
    public static function slug(): string
    {
        return 'operations';
    }

    public static function label(): string
    {
        return 'Operations';
    }

    public static function widgets(): array
    {
        return [
            StatsWidget::make('customer-count')
                ->label('Customers')
                ->resource(CustomerResource::class)
                ->count(),
        ];
    }
}

Add the dashboard class to the existing dashboards array in config/seviaflow-ui.php, then set the dashboard's slug as the default when appropriate:

'dashboards' => [
    App\SeviaFlow\Dashboards\OperationsDashboard::class,
],

'dashboard' => [
    'default' => 'operations',
],

Merge these entries into the published UI configuration; do not replace unrelated settings. The default route is /admin. A custom dashboard can also be opened at /admin/dashboards/operations when the default route prefix is in use.

Dashboard and widget access

A dashboard may implement visibleFor($user), roles(), or permissions() to control whether it appears for a user. Those checks control access to the dashboard surface; widgets must still respect the Resource authorization and query scope for the data they show. The example's count() widget delegates its record visibility and tenant scope to CustomerResource.

Built-in routes

RouteNameWhat it displays
GET /adminseviaflow.dashboardThe configured default dashboard, or the first visible dashboard.
GET /admin/dashboards/{dashboard}seviaflow.dashboards.showThe dashboard identified by its configured slug.

These are the default paths. The route prefix and dashboard availability are controlled by the UI configuration.

Dashboard configuration

SettingDefaultWhat it controls
dashboard.enabledtrueEnables the dashboard pages.
dashboard.defaultnullSelects the default dashboard by slug or class name.
dashboard.show_resource_countsfalseControls the built-in Resource counts summary.
dashboard.show_workflow_attention_countsfalseControls the built-in workflow-attention summary.
dashboard.recent_activity_limit10Maximum recent activity items in the default dashboard.
dashboard.cache_ttl60Cache lifetime in seconds for dashboard summaries.
dashboard.table_widgets.max_limit, workflow_widgets.max_limit, recent_activity_widgets.max_limit25 eachCaps the number of rows or events a built-in widget can request.

Widget types and caching

Dashboard widgets include statistics, tables, recent activity, workflow queues, analytics metrics, and analytics charts. Analytics chart widgets support line, bar, grouped_bar, stacked_bar, and doughnut presentations. SeviaFlow UI supplies the widgets; your dashboard class chooses which ones to show.

Dashboard caching is disabled by default. If you enable seviaflow-ui.cache.dashboard, set SEVIAFLOW_CACHE_ISOLATION_CONTEXT for the host or installation boundary. Change SEVIAFLOW_CACHE_PERMISSION_VERSION after permission changes and SEVIAFLOW_CACHE_DATA_VERSION after data invalidation events, or run php artisan seviaflow:cache-clear. Cache-off tests do not verify cache-on isolation.