Get rid of index function for BudgetsController
MODIFY
app/Http/Controllers/BudgetsController.php
app/Http/Controllers/BudgetsController.php
@@ -8,19 +8,6 @@ use Auth;
use App\Budget;
class BudgetsController extends Controller {
- public function index() {
- $user = Auth::user();
-
- $currency = $user->currency->symbol;
-
- $budgets = $user->budgets()
- ->orderBy('year', 'DESC')
- ->orderBy('month', 'DESC')
- ->get();
-
- return view('budgets.index', compact('currency', 'budgets'));
- }
-
public function create() {
$tags = Auth::user()->tags;

DELETE
resources/views/budgets/index.blade.php
-@extends('layout')
-
-@section('body')
- <div class="row">
- <div class="column align-middle">
- <h1>Budgets</h1>
- </div>
- <div class="column align-right">
- <a href="/budgets/create" class="button">Create</a>
- </div>
- </div>
- <div class="box spacing-top-large">
- <table>
- <tbody>
- @foreach ($budgets as $budget)
- <tr>
- <td>@lang('months.' . $budget->month), {{ $budget->year }}</td>
- <td>{{ $currency }} {{ $budget->amount }}</td>
- <td>{{ $budget->tag->name }}</td>
- <td>
- <form class="test" method="POST" action="/budgets/{{ $budget->id }}">
- {{ method_field('DELETE') }}
- {{ csrf_field() }}
- <input type="submit" value="Delete" />
- </form>
- </td>
- </tr>
- @endforeach
- </tbody>
- </table>
- </div>
-@endsection

MODIFY
resources/views/layout.blade.php
resources/views/layout.blade.php
<li>
<a href="/search">Search</a>
</li>
- <li>
- <a href="/budgets">Budgets</a>
- </li>
<li>
<a href="/tags">Tags</a>
</li>

MODIFY
routes/web.php
routes/web.php
@@ -15,7 +15,7 @@ Route::group(['middleware' => ['auth']], function () {
Route::resource('/spendings', 'SpendingsController', ['only' => ['show', 'create', 'store', 'destroy']]);
- Route::resource('/budgets', 'BudgetsController', ['only' => ['index', 'create', 'store', 'destroy']]);
+ Route::resource('/budgets', 'BudgetsController', ['only' => ['create', 'store', 'destroy']]);
Route::resource('/tags', 'TagsController', ['only' => ['index', 'create', 'store', 'edit', 'update', 'destroy']]);

Get rid of index function for BudgetsController