Add show function for SpendingsController
MODIFY
app/Http/Controllers/SpendingsController.php
app/Http/Controllers/SpendingsController.php
@@ -34,4 +34,14 @@ class SpendingsController extends Controller {
return redirect()->route('dashboard');
}
+
+ public function show($id) {
+ $user = Auth::user();
+
+ $currency = $user->currency;
+
+ $spending = Spending::find($id);
+
+ return view('spendings.show', compact('currency', 'spending'));
+ }
}

MODIFY
resources/views/dashboard.blade.php
resources/views/dashboard.blade.php
<li>
<div class="row">
<div class="column">
- <p class="spacing-bottom-small">{{ $spending->description }}</p>
- <p>{{ $spending->tag->name }} &middot; {{ date('jS', strtotime($spending->date)) }}</p>
+ <a href="/spendings/{{ $spending->id }}">{{ $spending->description }}</a>
+ <p class="spacing-top-small">{{ $spending->tag->name }} &middot; {{ date('jS', strtotime($spending->date)) }}</p>
</div>
<div class="column text-align-right align-middle">
<h3>{{ $currency->symbol }} {{ $spending->amount }}</h3>

ADD
resources/views/spendings/show.blade.php
+@extends('layout')
+
+@section('body')
+ <div class="wrapper spacing-top-large spacing-bottom-large">
+ <div class="box">
+ <div class="section">
+ <div class="row">
+ <div class="column">
+ <h3>Spending</h3>
+ </div>
+ <div class="column text-align-right align-middle">
+ <a href="/dashboard/{{ date('Y', strtotime($spending->date)) }}/{{ date('n', strtotime($spending->date)) }}">Go back to @lang('months.' . date('n', strtotime($spending->date))) {{ date('Y', strtotime($spending->date)) }}</a>
+ </div>
+ </div>
+ </div>
+ <div class="section">
+ <div class="row gutter">
+ <div class="column">
+ <p class="spacing-bottom-small">Description</p>
+ <h3>{{ $spending->description }}</h3>
+ </div>
+ <div class="column">
+ <p class="spacing-bottom-small">Tag</p>
+ <h3>{{ $spending->tag->name }}</h3>
+ </div>
+ <div class="column">
+ <p class="spacing-bottom-small">Date</p>
+ <h3>{{ date('F jS, Y', strtotime($spending->date)) }}</h3>
+ </div>
+ <div class="column">
+ <p class="spacing-bottom-small">Amount</p>
+ <h3>{{ $currency->symbol }} {{ $spending->amount }}</h3>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+@endsection

MODIFY
routes/web.php
routes/web.php
@@ -18,6 +18,7 @@ Route::group(['middleware' => ['auth']], function () {
Route::get('/spendings/create', 'SpendingsController@create')->name('spendings.create');
Route::post('/spendings', 'SpendingsController@store');
+ Route::get('/spendings/{id}', 'SpendingsController@show')->name('spendings.show');
Route::get('/budgets/create', 'BudgetsController@create')->name('budgets.create');
Route::post('/budgets', 'BudgetsController@store');

Add show function for SpendingsController