Get rid of partials's currency view
MODIFY
app/Http/Controllers/DashboardController.php
app/Http/Controllers/DashboardController.php
@@ -4,8 +4,12 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
+use Auth;
+
class DashboardController extends Controller {
public function index() {
- return view('dashboard.index');
+ $currency = Auth::user()->currency;
+
+ return view('dashboard.index', compact('currency'));
}
}

MODIFY
app/Http/Controllers/ReportsController.php
app/Http/Controllers/ReportsController.php
@@ -26,7 +26,7 @@ class ReportsController extends Controller {
public function show($year, $month) {
$user = Auth::user();
- $currency = view('partials.currency');
+ $currency = $user->currency;
$earnings = Earning::where('user_id', $user->id)
->whereYear('date', $year)

MODIFY
resources/views/dashboard/index.blade.php
resources/views/dashboard/index.blade.php
@foreach (Auth::user()->earnings as $earning)
<tr>
<td>{{ $earning->description }}</td>
- <td>@include('partials.currency') {{ $earning->amount }}</td>
+ <td>{{ $currency->symbol }} {{ $earning->amount }}</td>
</tr>
@endforeach
</tbody>
@foreach (Auth::user()->spendings as $spending)
<tr>
<td>{{ $spending->description }}</td>
- <td>@include('partials.currency') {{ $spending->amount }}</td>
+ <td>{{ $currency->symbol }} {{ $spending->amount }}</td>
</tr>
@endforeach
</tbody>

DELETE
resources/views/partials/currency.blade.php
-{{ Auth::user()->currency->symbol }}

MODIFY
resources/views/reports/show.blade.php
resources/views/reports/show.blade.php
<div class="row">
<div class="column">
<div class="box spacing-large">
- <h1 class="color-green spacing-bottom-small">{{ $currency }} {{ $earnings }}</h1>
+ <h1 class="color-green spacing-bottom-small">{{ $currency->symbol }} {{ $earnings }}</h1>
<p>Earnings</p>
</div>
</div>
<div class="column">
<div class="box spacing-large">
- <h1 class="color-red spacing-bottom-small">{{ $currency }} {{ $spendings }}</h1>
+ <h1 class="color-red spacing-bottom-small">{{ $currency->symbol }} {{ $spendings }}</h1>
<p>Spendings</p>
</div>
</div>
<div class="column">
<div class="box spacing-large">
- <h1 class="color-blue spacing-bottom-small">{{ $currency }} {{ $earnings - $spendings }}</h1>
+ <h1 class="color-blue spacing-bottom-small">{{ $currency->symbol }} {{ $earnings - $spendings }}</h1>
<p>Balance</p>
</div>
</div>
@foreach ($budgets as $budget)
<tr>
<td>{{ $budget->tag->name }}</td>
- <td>{{ $currency }} {{ $budget->spendings()->sum('amount') }} of {{ $currency }} {{ $budget->amount }}</td>
+ <td>{{ $currency->symbol }} {{ $budget->spendings()->sum('amount') }} of {{ $currency->symbol }} {{ $budget->amount }}</td>
</tr>
@endforeach
</tbody>

Get rid of partials's currency view