moonshine-software / moonshine

Laravel Admin panel and more. Simple for beginners and powerful for experts. Using Blade, Alpine.js and Tailwind CSS.
https://moonshine-laravel.com
MIT License
797 stars 104 forks source link

feat: Fragment metrics #1354

Closed lee-to closed 2 days ago

lee-to commented 2 days ago
protected function metrics(): array
{
    return [
        ValueMetric::make('Articles')->value(fn() => Article::count())->columnSpan(6),
        ValueMetric::make('Comments')->value(fn() => Comment::count())->columnSpan(6),
        ValueMetric::make('Comments')->value(fn() => Comment::count())->columnSpan(12),
        ValueMetric::make('Comments')->value(fn() => Comment::count())->columnSpan(12),
        ValueMetric::make('Comments')->value(fn() => Comment::count())->columnSpan(4),
        ValueMetric::make('Comments')->value(fn() => Comment::count())->columnSpan(4),
        ValueMetric::make('Comments')->value(fn() => Comment::count())->columnSpan(4),
    ];
}

protected function fragmentMetrics(): ?Closure
{
    return static fn($components) => Fragment::make($components)->name('metrics');
}