feat: admin dashboard widgets
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
/**
|
||||
* One card on the admin dashboard, as its provider assembled it.
|
||||
*
|
||||
* Every widget has the same shape so the dashboard can render a list it knows nothing about.
|
||||
* The action link is optional and lands in the card's header — typically "show the full list
|
||||
* this widget is an excerpt of".
|
||||
*/
|
||||
final readonly class DashboardWidget
|
||||
{
|
||||
/**
|
||||
* @param DashboardWidgetEntry[] $entries
|
||||
*/
|
||||
public function __construct(
|
||||
public string $title,
|
||||
public array $entries,
|
||||
public string $emptyText = 'Keine Einträge vorhanden.',
|
||||
public ?string $actionUrl = null,
|
||||
public ?string $actionLabel = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
/**
|
||||
* One line in a dashboard widget: a label, optionally where it leads, and an optional icon.
|
||||
*
|
||||
* The url is generated by the widget provider rather than built in the template, so a provider
|
||||
* is free to link anywhere without the dashboard learning its routes. Leaving it out makes the
|
||||
* line display-only — a widget that reports rather than navigates.
|
||||
*/
|
||||
final readonly class DashboardWidgetEntry
|
||||
{
|
||||
public function __construct(
|
||||
public string $label,
|
||||
public ?string $url = null,
|
||||
public ?string $icon = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user