diff --git a/app/Http/Redirection.php b/app/Http/Redirection.php new file mode 100644 index 0000000..2f602a9 --- /dev/null +++ b/app/Http/Redirection.php @@ -0,0 +1,16 @@ +

PHP Monitor (“phpmon”) is a lightweight, native Mac menu bar app that interacts with Valet.

- Sponsor - GitHub - Download + Sponsor + GitHub + Download
diff --git a/routes/web.php b/routes/web.php index ebe4d5b..99300a9 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,9 +1,16 @@ view('homepage')); -Route::get('/github', fn () => redirect()->to('https://github.com/nicoverbruggen/phpmon')); -Route::get('/sponsor', fn () => redirect()->to('https://nicoverbruggen.be/sponsor')); -Route::get('/donate', fn () => redirect()->to('https://nicoverbruggen.be/sponsor')); +collect([ + Redirection::named('github', '/github', 'https://github.com/nicoverbruggen/phpmon'), + Redirection::named('releases', '/releases', 'https://github.com/nicoverbruggen/phpmon/releases'), + Redirection::named('faq', '/faq', 'https://github.com/nicoverbruggen/phpmon#%EF%B8%8F-faq--troubleshooting'), + Redirection::named('sponsor', '/sponsor', 'https://nicoverbruggen.be/sponsor'), + Redirection::named('sponsor.now', '/sponsor/now', 'https://nicoverbruggen.be/sponsor#pay-now'), +])->each(function (Redirection $r) { + Route::get($r->url, fn () => redirect()->to($r->target))->name($r->name); +}); \ No newline at end of file diff --git a/tests/Feature/RedirectReachabilityTest.php b/tests/Feature/RedirectReachabilityTest.php new file mode 100644 index 0000000..b3d510d --- /dev/null +++ b/tests/Feature/RedirectReachabilityTest.php @@ -0,0 +1,20 @@ +get('/github'); + $response->assertStatus(302); + $response->assertRedirect('https://github.com/nicoverbruggen/phpmon'); + + $this->get('/faq')->assertStatus(302); + $this->get('/releases')->assertStatus(302); + $this->get('/sponsor')->assertStatus(302); + $this->get('/sponsor/now')->assertStatus(302); + } +}