From 65f797a5284a1f9826ed46317bff43659206490b Mon Sep 17 00:00:00 2001 From: Lukas Leitsch Date: Wed, 31 May 2023 12:47:47 +0200 Subject: [PATCH] use class reference to fix controller not found error --- routes/cp.php | 18 ++++++++++++------ src/Http/Controllers/BrokenLinksController.php | 2 +- .../CertificateHealthController.php | 2 +- .../Controllers/MixedContentController.php | 2 +- src/Http/Controllers/OverviewController.php | 2 +- src/Http/Controllers/UptimeController.php | 2 +- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/routes/cp.php b/routes/cp.php index c2c6edc..cf5edf0 100644 --- a/routes/cp.php +++ b/routes/cp.php @@ -6,10 +6,16 @@ |-------------------------------------------------------------------------- */ +use Jonassiewertsen\OhDear\Http\Controllers\BrokenLinksController; +use Jonassiewertsen\OhDear\Http\Controllers\CertificateHealthController; +use Jonassiewertsen\OhDear\Http\Controllers\MixedContentController; +use Jonassiewertsen\OhDear\Http\Controllers\OverviewController; +use Jonassiewertsen\OhDear\Http\Controllers\UptimeController; + Route::prefix('oh-dear/')->name('oh-dear.')->group(function() { - Route::get('/', 'OverviewController@index')->name('index'); - Route::get('/uptime', 'UptimeController@index')->name('uptime'); - Route::get('/broken-links', 'BrokenLinksController@index')->name('broken-links'); - Route::get('/mixed-content', 'MixedContentController@index')->name('mixed-content'); - Route::get('/certificate-health', 'CertificateHealthController@index')->name('certificate-health'); -}); \ No newline at end of file + Route::get('/', OverviewController::class)->name('index'); + Route::get('/uptime', UptimeController::class)->name('uptime'); + Route::get('/broken-links', BrokenLinksController::class)->name('broken-links'); + Route::get('/mixed-content', MixedContentController::class)->name('mixed-content'); + Route::get('/certificate-health', CertificateHealthController::class)->name('certificate-health'); +}); diff --git a/src/Http/Controllers/BrokenLinksController.php b/src/Http/Controllers/BrokenLinksController.php index b3c1267..5561411 100644 --- a/src/Http/Controllers/BrokenLinksController.php +++ b/src/Http/Controllers/BrokenLinksController.php @@ -4,7 +4,7 @@ class BrokenLinksController extends Controller { - public function index() + public function __invoke() { $this->authorize('show ohdear'); diff --git a/src/Http/Controllers/CertificateHealthController.php b/src/Http/Controllers/CertificateHealthController.php index bdc2374..01d818f 100644 --- a/src/Http/Controllers/CertificateHealthController.php +++ b/src/Http/Controllers/CertificateHealthController.php @@ -4,7 +4,7 @@ class CertificateHealthController extends Controller { - public function index() + public function __invoke() { $this->authorize('show ohdear'); diff --git a/src/Http/Controllers/MixedContentController.php b/src/Http/Controllers/MixedContentController.php index 21b74da..d12f5a7 100644 --- a/src/Http/Controllers/MixedContentController.php +++ b/src/Http/Controllers/MixedContentController.php @@ -4,7 +4,7 @@ class MixedContentController extends Controller { - public function index() + public function __invoke() { $this->authorize('show ohdear'); diff --git a/src/Http/Controllers/OverviewController.php b/src/Http/Controllers/OverviewController.php index e0115c4..df28ece 100644 --- a/src/Http/Controllers/OverviewController.php +++ b/src/Http/Controllers/OverviewController.php @@ -4,7 +4,7 @@ class OverviewController extends Controller { - public function index() + public function __invoke() { $this->authorize('show ohdear'); diff --git a/src/Http/Controllers/UptimeController.php b/src/Http/Controllers/UptimeController.php index 3fdb4c8..0bf2a20 100644 --- a/src/Http/Controllers/UptimeController.php +++ b/src/Http/Controllers/UptimeController.php @@ -4,7 +4,7 @@ class UptimeController extends Controller { - public function index() + public function __invoke() { $this->authorize('show ohdear');