You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 Final fix delete storage link to fix news_images and logs 🆙
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\Article;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Flowframe\Trend\Trend;
|
||||
use Flowframe\Trend\TrendValue;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class ArticlesAggregateChart extends ChartWidget
|
||||
{
|
||||
protected static ?int $sort = 2;
|
||||
|
||||
protected ?string $maxHeight = '300px';
|
||||
|
||||
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(Article::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';
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\ItemDefinition;
|
||||
use App\Models\Miscellaneous\CameraWeb;
|
||||
use App\Models\Room;
|
||||
use App\Models\User;
|
||||
use App\Models\WebsiteBadge;
|
||||
use Filament\Support\Enums\IconPosition;
|
||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
use Illuminate\Support\Number;
|
||||
|
||||
class TopDashboardOverview extends BaseWidget
|
||||
{
|
||||
protected static ?int $sort = 1;
|
||||
|
||||
#[\Override]
|
||||
protected function getStats(): array
|
||||
{
|
||||
return [
|
||||
Stat::make(__('filament::resources.stats.users_count.title'), Number::format(User::count(), '0', '1', app()->getLocale()))
|
||||
->description(__('filament::resources.stats.users_count.description'))
|
||||
->chart([20, 20])
|
||||
->descriptionIcon('heroicon-m-user-group', IconPosition::Before)
|
||||
->color('success'),
|
||||
|
||||
Stat::make(__('filament::resources.stats.furniture_count.title'), Number::format(ItemDefinition::count(), '0', '1', app()->getLocale()))
|
||||
->description(__('filament::resources.stats.furniture_count.description'))
|
||||
->descriptionIcon('heroicon-m-cube', IconPosition::Before)
|
||||
->chart([20, 20])
|
||||
->color('success'),
|
||||
|
||||
Stat::make(__('filament::resources.stats.rooms_count.title'), Number::format(Room::count(), '0', '1', app()->getLocale()))
|
||||
->description(__('filament::resources.stats.rooms_count.description'))
|
||||
->descriptionIcon('heroicon-m-building-storefront', IconPosition::Before)
|
||||
->chart([20, 20])
|
||||
->color('success'),
|
||||
|
||||
Stat::make(__('filament::resources.stats.photos_count.title'), Number::format(CameraWeb::count(), '0', '1', app()->getLocale()))
|
||||
->description(__('filament::resources.stats.photos_count.description'))
|
||||
->descriptionIcon('heroicon-m-camera', IconPosition::Before)
|
||||
->chart([20, 20])
|
||||
->color('success'),
|
||||
|
||||
Stat::make(__('filament::resources.stats.badge_count.title'), Number::format(WebsiteBadge::count(), '0', '1', app()->getLocale()))
|
||||
->description(__('filament::resources.stats.badge_count.description'))
|
||||
->descriptionIcon('heroicon-m-gif', IconPosition::Before)
|
||||
->chart([20, 20])
|
||||
->color('success'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user