Fix named routes
MODIFY
app/Http/Controllers/EarningsController.php
app/Http/Controllers/EarningsController.php
@@ -27,6 +27,6 @@ class EarningsController extends Controller {
$earning->save();
- return redirect()->route('dashboard_get');
+ return redirect()->route('dashboard.index');
}
}

MODIFY
app/Http/Controllers/LoginController.php
app/Http/Controllers/LoginController.php
@@ -18,9 +18,9 @@ class LoginController extends Controller {
'email' => $email,
'password' => $password
])) {
- return redirect()->route('dashboard_get');
+ return redirect()->route('dashboard.index');
} else {
- return redirect()->route('login_get');
+ return redirect()->route('login.index');
}
}
}

MODIFY
app/Http/Controllers/LogoutController.php
app/Http/Controllers/LogoutController.php
@@ -9,6 +9,6 @@ class LogoutController extends Controller {
public function index() {
Auth::logout();
- return redirect()->route('login_get');
+ return redirect()->route('login.index');
}
}

MODIFY
app/Http/Controllers/SettingsController.php
app/Http/Controllers/SettingsController.php
@@ -18,6 +18,6 @@ class SettingsController extends Controller {
$user->save();
- return redirect()->route('settings_get');
+ return redirect()->route('settings.index');
}
}

MODIFY
routes/web.php
routes/web.php
<?php
-Route::get('/login', 'LoginController@index')->name('login_get');
-Route::post('/login', 'LoginController@store')->name('login_post');
+Route::get('/login', 'LoginController@index')->name('login.index');
+Route::post('/login', 'LoginController@store')->name('login.store');
Route::group(['middleware' => ['auth']], function () {
- Route::get('/dashboard', 'DashboardController@index')->name('dashboard_get');
+ Route::get('/dashboard', 'DashboardController@index')->name('dashboard.index');
- Route::get('/earnings/create', 'EarningsController@create')->name('earnings_create_get');
- Route::post('/earnings', 'EarningsController@store')->name('earnings_store_post');
+ Route::resource('/earnings', 'EarningsController', ['only' => ['create', 'store']]);
- Route::get('/reports', 'ReportsController@index')->name('reports_index_get');
- Route::get('/reports/{year}/{month}', 'ReportsController@show')->name('reports_show_get');
+ Route::get('/reports', 'ReportsController@index')->name('reports.index');
+ Route::get('/reports/{year}/{month}', 'ReportsController@show')->name('reports.show');
- Route::get('/settings', 'SettingsController@index')->name('settings_get');
- Route::post('/settings', 'SettingsController@store')->name('settings_post');
+ Route::get('/settings', 'SettingsController@index')->name('settings.index');
+ Route::post('/settings', 'SettingsController@store')->name('settings.store');
});
-Route::get('/logout', 'LogoutController@index')->name('logout_get');
+Route::get('/logout', 'LogoutController@index')->name('logout.index');

Fix named routes