Get rid of BudgetsController and it's model, views and migration
DELETE
app/Budget.php
-<?php
-
-namespace App;
-
-use Illuminate\Database\Eloquent\Model;
-
-use App\Spending;
-
-use Auth;
-
-class Budget extends Model {
- public $timestamps = false;
-
- public function tag() {
- return $this->belongsTo('App\Tag');
- }
-
- public function spendings() {
- $user = Auth::user();
-
- return Spending::where('user_id', $user->id)
- ->whereYear('date', $this->attributes['year'])
- ->whereMonth('date', $this->attributes['month'])
- ->where('tag_id', $this->attributes['tag_id'])
- ->get();
- }
-}

DELETE
app/Http/Controllers/BudgetsController.php
-<?php
-
-namespace App\Http\Controllers;
-
-use Illuminate\Http\Request;
-
-use Auth;
-use App\Budget;
-
-class BudgetsController extends Controller {
- public function create() {
- $tags = Auth::user()->tags;
-
- return view('budgets.create', compact('tags'));
- }
-
- public function store(Request $request) {
- $budget = new Budget;
-
- $budget->user_id = Auth::user()->id;
- $budget->tag_id = $request->tag;
- $budget->year = $request->year;
- $budget->month = $request->month;
- $budget->amount = $request->amount;
-
- $budget->save();
-
- return redirect()->route('dashboard');
- }
-}

DELETE
resources/views/budgets/create.blade.php
-@extends('layout')
-
-@section('body')
- <div class="wrapper spacing-top-large spacing-bottom-large">
- <div class="box">
- <div class="section">
- <h3>Budgets &middot; Create</h3>
- </div>
- <div class="section">
- <form method="POST" action="/budgets">
- {{ csrf_field() }}
- <label>Tag</label>
- <select name="tag">
- <option>-</option>
- @foreach ($tags as $tag)
- <option value="{{ $tag->id }}">{{ $tag->name }}</option>
- @endforeach
- </select>
- <div class="row gutter">
- <div class="column">
- <label>Year</label>
- <input type="text" name="year" />
- </div>
- <div class="column">
- <label>Month</label>
- <select name="month">
- <option>-</option>
- @for ($month = 1; $month <= 12; $month ++)
- <option value="{{ $month }}">@lang('calendar.months.' . $month)</option>
- @endfor
- </select>
- </div>
- </div>
- <label>Amount</label>
- <input type="text" name="amount" />
- <button>@lang('actions.create')</button>
- </form>
- </div>
- </div>
- </div>
-@endsection

MODIFY
routes/web.php
routes/web.php
@@ -21,9 +21,6 @@ Route::group(['middleware' => ['auth']], function () {
Route::post('/spendings', 'SpendingsController@store');
Route::delete('/spendings/{spending}', 'SpendingsController@destroy')->middleware('can:delete,spending');
- Route::get('/budgets/create', 'BudgetsController@create')->name('budgets.create');
- Route::post('/budgets', 'BudgetsController@store');
-
Route::get('/tags', 'TagsController@index')->name('tags');
Route::get('/tags/create', 'TagsController@create')->name('tags.create');
Route::post('/tags', 'TagsController@store');

Get rid of BudgetsController and it's model, views and migration