Create index view for ReportsController
MODIFY
app/Http/Controllers/ReportsController.php
app/Http/Controllers/ReportsController.php
@@ -5,6 +5,10 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ReportsController extends Controller {
+ public function index() {
+ return view('reports.index');
+ }
+
public function show($year, $month) {
return view('reports.show', [
'year' => $year,

MODIFY
resources/views/layout.blade.php
resources/views/layout.blade.php
<li>
<a href="/dashboard">Dashboard</a>
</li>
+ <li>
+ <a href="/reports">Reports</a>
+ </li>
</ul>
<ul>
<li>

ADD
resources/views/reports/index.blade.php
+@extends('layout')
+
+@section('body')
+ <h1>Reports</h1>
+ <div class="box spacing-bottom-large">
+ <table class="box__section">
+ <tbody>
+ @for ($y = 2017; $y <= date('Y'); $y ++)
+ @for ($m = 1; $m <= 12; $m ++)
+ @if (App\Budget::where('user_id', Auth::user()->id)->whereMonth('date', $m)->whereYear('date', $y)->count())
+ <tr>
+ <td>
+ <a href="/reports/{{ $y }}/{{ $m }}">{{ $m }}, {{ $y }}</a>
+ </td>
+ </tr>
+ @endif
+ @endfor
+ @endfor
+ </tbody>
+ </table>
+ </div>
+@endsection

MODIFY
routes/web.php
routes/web.php
@@ -6,6 +6,7 @@ Route::post('/login', 'LoginController@store')->name('login_post');
Route::group(['middleware' => ['auth']], function () {
Route::get('/dashboard', 'DashboardController@index')->name('dashboard_get');
+ Route::get('/reports', 'ReportsController@index')->name('reports_index_get');
Route::get('/reports/{year}/{month}', 'ReportsController@show')->name('reports_show_get');
Route::get('/settings', 'SettingsController@index')->name('settings_get');

Create index view for ReportsController