get() ->groupBy([ fn($mutation) => $mutation->type, fn($mutation) => Carbon::parse($mutation->getRawOriginal('created_at'))->format('M'), ]); $topUp = TopUp::get()->groupBy('member_id'); return inertia('home/Index.vue', [ 'cardStatistics' => [ // [ // 'title' => ..., // 'icon' => ...', // 'amount' => ..., // 'amountLabel' => ..., // 'value' => ..., // ], [ 'title' => __('words.member'), 'icon' => 'pi pi-id-card', 'amount' => $member->count(), 'amountLabel' => __('words.total'), ], [ 'title' => __('words.type_member'), 'icon' => 'pi pi-id-card', 'amount' => $typeMember->count(), 'amountLabel' => __('words.total'), ], [ 'title' => __('words.type_vehicle'), 'icon' => 'pi pi-car', 'amount' => $typeVehicle->count(), 'amountLabel' => __('words.total'), ], ], 'barStatistics' => [ [ 'title' => __('words.mutation_statistic'), 'description' => __('words.per_year') . ' ' . date('Y'), 'data' => (new MutationService)->statistic($mutation), ], ], 'barHorizontalStatistics' => [ [ 'title' => __('words.top_up_rank'), 'description' => __('words.top_up_number_rank', ['number' => 5]), 'data' => (new TopUpService)->topUpRank($topUp), ], ], ]); } }