Display amount of spendings per tag on settings view
MODIFY
app/Tag.php
app/Tag.php
@@ -4,6 +4,10 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
+use App\Spending;
+
class Tag extends Model {
- //
+ public function spendings() {
+ return $this->hasMany(Spending::class);
+ }
}

MODIFY
resources/views/settings.blade.php
resources/views/settings.blade.php
<ul class="box__section">
@foreach ($tags as $tag)
<li class="row">
- <div class="row__column">{{ $tag->name }}</div>
+ <div class="row__column">
+ <div>{{ $tag->name }}</div>
+ <div class="mt-1"><i class="fal fa-piggy-bank"></i> {{ $tag->spendings->count() }} {{ __('general.spendings') }}</div>
+ </div>
<div class="row__column row__column--compact">
<a href="/tags/{{ $tag->id }}/edit">
<i class="fas fa-pencil"></i>

Display amount of spendings per tag on settings view