@php
$statisticsCaption = getContent('statistics.caption',true);
@endphp
@if($statisticsCaption)
@php
$collection['day'] = collect([]);
$collection['trx'] = collect([]);
\App\Invest::where('created_at', '>', \Carbon\Carbon::now()->subDays(7))
->selectRaw('SUM(amount) as totalTransaction ')
->selectRaw("DATE_FORMAT(created_at, '%W') day")
->groupBy(\Illuminate\Support\Facades\DB::raw('DATE(created_at)'))
->get()->map(function ($v, $key) use ($collection) {
if ($v->totalTransaction == null) {
$collection['trx']->push(round($v->totalTransaction, 2));
} else {
$collection['trx']->push(round($v->totalTransaction, 2));
}
$collection['day']->push($v->day);
return $collection;
});
@endphp
{{__(@$statisticsCaption->data_values->short_details)}}{{__(@$statisticsCaption->data_values->title)}}