Seiten · Laravilt
Custom Widgets
Generate widget classes and show them on dashboards and pages.
Generating a widget
With --panel, the class is created in app/Laravilt/{Panel}/Widgets (namespace App\Laravilt\{Panel}\Widgets). Without it, the class goes to app/Widgets. Missing options are asked interactively, including whether to enable polling.
Stats widget
Chart widget
Basic widget
A basic widget extends Laravilt\Widgets\Widget and implements toInertiaProps(). The component key selects the frontend component that renders it:
Showing widgets
Any panel page with a getWidgets() method renders those widgets above its content. Return widget instances or class names. Class names are instantiated with no constructor arguments.
To customize the dashboard, extend the panel's Dashboard page:
The dashboard also has getHeaderWidgets(), which by default returns the automatic resource stats followed by getWidgets(), and getFooterWidgets(), which renders widgets below the content. See Pages for registering pages in a panel.