You've already forked Atomcms-edit
Modernize dependencies: replace abandoned packages, update versions
- Replace flowframe/laravel-trend with direct Eloquent DB queries
- Replace srmklive/paypal (abandoned) with new PayPalService using PayPal REST API v2 via Guzzle
- Remove old config/paypal.php, migrate to config('habbo.paypal.*')
- Update blade templates to use habbo.paypal config
- Bump npm packages to latest: @inertiajs/react, axios, esbuild, eslint, sass, tailwindcss, etc.
- Run composer update and yarn upgrade
This commit is contained in:
@@ -4,9 +4,8 @@ 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;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ArticlesAggregateChart extends ChartWidget
|
||||
{
|
||||
@@ -34,13 +33,12 @@ class ArticlesAggregateChart extends ChartWidget
|
||||
#[\Override]
|
||||
protected function getData(): array
|
||||
{
|
||||
$data = Trend::model(WebsiteArticle::class)
|
||||
->between(
|
||||
start: now()->startOfMonth(),
|
||||
end: now()->endOfMonth(),
|
||||
)
|
||||
->perDay()
|
||||
->count();
|
||||
$data = WebsiteArticle::query()
|
||||
->whereBetween('created_at', [now()->startOfMonth(), now()->endOfMonth()])
|
||||
->selectRaw('DATE(created_at) as date, COUNT(*) as aggregate')
|
||||
->groupBy(DB::raw('DATE(created_at)'))
|
||||
->orderBy('date')
|
||||
->get();
|
||||
|
||||
$label = __('filament::resources.stats.articles_chart.label');
|
||||
|
||||
@@ -48,10 +46,10 @@ class ArticlesAggregateChart extends ChartWidget
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => $label,
|
||||
'data' => $data->map(fn (TrendValue $value) => $value->aggregate),
|
||||
'data' => $data->pluck('aggregate'),
|
||||
],
|
||||
],
|
||||
'labels' => $data->map(fn (TrendValue $value) => $value->date),
|
||||
'labels' => $data->pluck('date'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user