From 74e0f3885d07890c8024c80b994e37e1a33247b7 Mon Sep 17 00:00:00 2001 From: Linus Juhlin Date: Sun, 7 Apr 2019 20:45:23 +0900 Subject: [PATCH] Made the single-purpose controllers into invokable controllers instead. --- app/Http/Controllers/DashboardController.php | 2 +- app/Http/Controllers/ReportsController.php | 2 +- routes/web.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 9adb90d..0ddb10d 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -6,7 +6,7 @@ use Inertia\Inertia; class DashboardController extends Controller { - public function index() + public function __invoke() { return Inertia::render('Dashboard/Index'); } diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 61738db..ecc6f6f 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -6,7 +6,7 @@ use Inertia\Inertia; class ReportsController extends Controller { - public function index() + public function __invoke() { return Inertia::render('Reports/Index'); } diff --git a/routes/web.php b/routes/web.php index f0ef8c7..bd3e80c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -17,7 +17,7 @@ Route::post('login')->name('login.attempt')->uses('Auth\LoginController@login'); Route::get('logout')->name('logout')->uses('Auth\LoginController@logout'); // Dashboard -Route::get('/')->name('dashboard')->uses('DashboardController@index')->middleware('auth'); +Route::get('/')->name('dashboard')->uses('DashboardController')->middleware('auth'); // Accounts Route::get('accounts')->name('accounts')->uses('AccountsController@index')->middleware('remember', 'auth'); @@ -56,7 +56,7 @@ Route::delete('contacts/{contact}')->name('contacts.destroy')->uses('ContactsCon Route::put('contacts/{contact}/restore')->name('contacts.restore')->uses('ContactsController@restore')->middleware('auth'); // Reports -Route::get('reports')->name('reports')->uses('ReportsController@index')->middleware('auth'); +Route::get('reports')->name('reports')->uses('ReportsController')->middleware('auth'); // 500 error Route::get('500', function () {