Get rid of show functions in both EarningsController and SpendingsController
MODIFY
app/Http/Controllers/EarningsController.php
app/Http/Controllers/EarningsController.php
@@ -44,14 +44,6 @@ class EarningsController extends Controller {
return redirect()->route('dashboard');
}
- public function show(Earning $earning) {
- $user = Auth::user();
-
- $currency = $user->currency;
-
- return view('earnings.show', compact('currency', 'earning'));
- }
-
public function destroy(Earning $earning) {
$year = date('Y', strtotime($earning->date));
$month = date('n', strtotime($earning->date));

MODIFY
app/Http/Controllers/SpendingsController.php
app/Http/Controllers/SpendingsController.php
@@ -49,14 +49,6 @@ class SpendingsController extends Controller {
return redirect()->route('dashboard');
}
- public function show(Spending $spending) {
- $user = Auth::user();
-
- $currency = $user->currency;
-
- return view('spendings.show', compact('currency', 'spending'));
- }
-
public function destroy(Spending $spending) {
$year = date('Y', strtotime($spending->date));
$month = date('n', strtotime($spending->date));

DELETE
resources/views/earnings/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>Earning</h3>
- </div>
- <div class="column text-align-right align-middle">
- <a href="/dashboard/{{ date('Y', strtotime($earning->date)) }}/{{ date('n', strtotime($earning->date)) }}">Go back to @lang('months.' . date('n', strtotime($earning->date))) {{ date('Y', strtotime($earning->date)) }}</a>
- </div>
- </div>
- </div>
- <div class="section">
- <div class="row gutter">
- <div class="column">
- <p class="spacing-bottom-small">Description</p>
- <h3>{{ $earning->description }}</h3>
- </div>
- <div class="column">
- <p class="spacing-bottom-small">Date</p>
- <h3>{{ date('F jS, Y', strtotime($earning->date)) }}</h3>
- </div>
- <div class="column">
- <p class="spacing-bottom-small">Amount</p>
- <h3>{{ $currency->symbol }} {{ $earning->amount }}</h3>
- </div>
- </div>
- <form method="POST" action="/earnings/{{ $earning->id }}">
- {{ method_field('delete') }}
- {{ csrf_field() }}
- <button>@lang('actions.delete')</button>
- </form>
- </div>
- </div>
- </div>
-@endsection

DELETE
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>
- <form method="POST" action="/spendings/{{ $spending->id }}">
- {{ method_field('delete') }}
- {{ csrf_field() }}
- <button>@lang('actions.delete')</button>
- </form>
- </div>
- </div>
- </div>
-@endsection

MODIFY
routes/web.php
routes/web.php
@@ -14,13 +14,11 @@ Route::group(['middleware' => ['auth']], function () {
Route::get('/earnings', 'EarningsController@index')->name('earnings.index');
Route::get('/earnings/create', 'EarningsController@create')->name('earnings.create');
Route::post('/earnings', 'EarningsController@store');
- Route::get('/earnings/{earning}', 'EarningsController@show')->name('earnings.show')->middleware('can:view,earning');
Route::delete('/earnings/{earning}', 'EarningsController@destroy')->middleware('can:delete,earning');
Route::get('/spendings', 'SpendingsController@index')->name('spendings.index');
Route::get('/spendings/create', 'SpendingsController@create')->name('spendings.create');
Route::post('/spendings', 'SpendingsController@store');
- Route::get('/spendings/{spending}', 'SpendingsController@show')->name('spendings.show')->middleware('can:view,spending');
Route::delete('/spendings/{spending}', 'SpendingsController@destroy')->middleware('can:delete,spending');
Route::get('/budgets/create', 'BudgetsController@create')->name('budgets.create');

Get rid of show functions in both EarningsController and SpendingsController