Stop displaying most expensive tag and day
MODIFY
app/Http/Controllers/DashboardController.php
app/Http/Controllers/DashboardController.php
@@ -16,40 +16,6 @@ class DashboardController extends Controller {
->whereRaw('MONTH(happened_on) = ?', [date('m')])
->sum('amount');
- $mostExpensiveTag = DB::select('
- SELECT
- tags.name AS name
- FROM
- tags
- LEFT OUTER JOIN
- spendings ON tags.id = spendings.tag_id
- WHERE
- tags.user_id = ?
- AND MONTH(happened_on) = ?
- GROUP BY
- tags.id
- HAVING
- SUM(spendings.amount) > 0
- ORDER BY
- SUM(spendings.amount) DESC
- LIMIT 1;
- ', [$user->id, date('m')]);
-
- $mostExpensiveWeekday = DB::select('
- SELECT
- WEEKDAY(spendings.happened_on) AS weekday
- FROM
- spendings
- WHERE
- spendings.user_id = ?
- AND MONTH(happened_on) = ?
- GROUP BY
- WEEKDAY(spendings.happened_on)
- ORDER BY
- SUM(spendings.amount) DESC
- LIMIT 1;
- ', [$user->id, date('m')]);
-
$recentSpendings = $user
->spendings()
->orderBy('created_at', 'DESC')
@@ -79,8 +45,6 @@ class DashboardController extends Controller {
'month' => date('n'),
'totalSpendings' => $totalSpendings,
- 'mostExpensiveTag' => $mostExpensiveTag,
- 'mostExpensiveWeekday' => $mostExpensiveWeekday,
'recentSpendings' => $recentSpendings,
'tagsBreakdown' => $tagsBreakdown,

MODIFY
resources/views/dashboard.blade.php
resources/views/dashboard.blade.php
</div>
</div>
<div class="row__column">
- <div class="card card--green">
- <h2 style="font-size: 20px;">{{ count($mostExpensiveTag) ? $mostExpensiveTag[0]->name : '-' }}</h2>
- <div class="mt-1" style="color: #A7AEBB;">{{ __('general.most_expensive_tag') }}</div>
- </div>
+ <!-- EMPTY -->
</div>
<div class="row__column">
- <div class="card card--red">
- <h2 style="font-size: 20px;">{{ count($mostExpensiveWeekday) ? __('calendar.weekdays.' . $mostExpensiveWeekday[0]->weekday) : '-' }}</h2>
- <div class="mt-1" style="color: #A7AEBB;">{{ __('general.most_expensive_day') }}</div>
- </div>
+ <!-- EMPTY -->
</div>
</div>
<div class="row row--gutter row--responsive mb-4">

Stop displaying most expensive tag and day