Skip to content

Commit 7e8bc89

Browse files
authored
Merge pull request #989 from srinathreddydudi/broken-links
fixed few broken links and added version BackedEnum to manage version easily
2 parents 263dcd9 + 8dab63c commit 7e8bc89

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

app/Enums/Version.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace App\Enums;
4+
5+
enum Version: string
6+
{
7+
case Four = '4.x';
8+
case Three = '3.x';
9+
case Two = '2.x';
10+
case One = '1.x';
11+
12+
public static function getLatest(): self
13+
{
14+
return self::Four;
15+
}
16+
}

resources/views/components/plugins/hero.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class="absolute inset-0 -z-10 h-full w-full rounded-full bg-[#8e7edd] transition
235235
</a>
236236
<a
237237
x-ref="how_to_make_plugins"
238-
href="/docs/support/plugins/getting-started"
238+
href="/docs/plugins/getting-started"
239239
class="group/button relative block"
240240
>
241241
{{-- Button --}}

resources/views/components/sunset.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class="mx-auto max-w-md px-4 pt-2 text-dolphin"
384384
class="px-4 pt-10"
385385
>
386386
<a
387-
href="{{ route('docs', ['slug' => 'panels/getting-started']) }}"
387+
href="{{ route('docs', ['slug' => 'introduction/overview']) }}"
388388
class="group/getstarted relative flex w-full items-center justify-between gap-5 overflow-hidden rounded-2xl px-10 py-8 ring-2 ring-transparent transition duration-300 hover:ring-peach-orange/40 motion-reduce:transition-none sm:py-10"
389389
>
390390
<div class="text-2xl font-bold sm:text-3xl">

resources/views/components/use-cases/admin-panel/introduction.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class="pt-5 text-xl text-dolphin"
5858
{{-- Link --}}
5959
<div class="grid place-items-center pt-10">
6060
<a
61-
href="{{ route('docs', ['slug' => 'panels/getting-started']) }}"
61+
href="{{ route('docs', ['slug' => 'introduction/overview']) }}"
6262
class="rounded-full bg-[#ffbc74] px-7 py-3 text-white transition duration-300 hover:bg-[#ffbc74]/80"
6363
>
6464
Get Started

routes/web.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use App\Enums\Version;
34
use App\Http\Controllers;
45
use App\Models\Article;
56
use App\Models\Plugin;
@@ -54,9 +55,11 @@
5455

5556
Route::redirect('/discord', 'https://discord.gg/filament')->name('discord');
5657

57-
Route::get('/api/{version?}', function (string $version = '4.x'): RedirectResponse {
58-
return redirect('/api/' . $version . '/index.html');
59-
})->where('version', '[1-4]+\.x')->name('api-docs');
58+
Route::get('/api/{version?}', function (?Version $version = null): RedirectResponse {
59+
$version = $version ?? Version::getLatest();
60+
61+
return redirect('/api/' . $version->value . '/index.html');
62+
})->name('api-docs');
6063

6164
Route::prefix('/docs')->group(function () {
6265
Route::get('/{slug?}', function (string $slug = null): string | RedirectResponse {
@@ -74,7 +77,7 @@
7477
$slug = trim($slug, '/');
7578

7679
if (filled($slug) && (! str_contains($slug, '.x'))) {
77-
return redirect()->route('docs', ['slug' => "4.x/{$slug}"]);
80+
return redirect()->route('docs', ['slug' => Version::getLatest()->value . "/{$slug}"]);
7881
}
7982

8083
$filePath = base_path("docs/preserved-dist/{$slug}/index.html");

0 commit comments

Comments
 (0)