Initial commit

This commit is contained in:
root
2026-05-09 17:28:23 +02:00
commit 9d73f82529
5575 changed files with 281989 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace App\Filament\Widgets;
use App\Models\Articles\WebsiteArticle;
use Filament\Widgets\ChartWidget;
use Flowframe\Trend\Trend;
use Flowframe\Trend\TrendValue;
use Illuminate\Contracts\Support\Htmlable;
class ArticlesAggregateChart extends ChartWidget
{
#[\Override]
protected static ?int $sort = 2;
#[\Override]
protected ?string $maxHeight = '300px';
#[\Override]
protected string $color = 'primary';
#[\Override]
public function getHeading(): string|Htmlable|null
{
return __('filament::resources.stats.articles_chart.title');
}
#[\Override]
public function getDescription(): string|Htmlable|null
{
return __('filament::resources.stats.articles_chart.description');
}
#[\Override]
protected function getData(): array
{
$data = Trend::model(WebsiteArticle::class)
->between(
start: now()->startOfMonth(),
end: now()->endOfMonth(),
)
->perDay()
->count();
$label = __('filament::resources.stats.articles_chart.label');
return [
'datasets' => [
[
'label' => $label,
'data' => $data->map(fn (TrendValue $value) => $value->aggregate),
],
],
'labels' => $data->map(fn (TrendValue $value) => $value->date),
];
}
protected function getType(): string
{
return 'line';
}
}