Skip to content

Commit 94b6dfa

Browse files
authored
[Bug] After login redirect to the admin panel instead of the root url (alexjustesen#968)
1 parent def87e8 commit 94b6dfa

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

app/Filament/Pages/Dashboard.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
class Dashboard extends BasePage
1616
{
17+
public bool $publicDashboard = false;
18+
1719
protected static ?string $pollingInterval = null;
1820

1921
protected static ?string $navigationIcon = 'heroicon-o-chart-bar';
@@ -22,11 +24,24 @@ class Dashboard extends BasePage
2224

2325
protected static string $view = 'filament.pages.dashboard';
2426

27+
public function mount()
28+
{
29+
$settings = new GeneralSettings();
30+
31+
$this->publicDashboard = $settings->public_dashboard_enabled;
32+
}
33+
2534
protected function getHeaderActions(): array
2635
{
2736
return [
37+
Action::make('home')
38+
->label('Public Dashboard')
39+
->color('gray')
40+
->hidden(! $this->publicDashboard)
41+
->url('/'),
2842
Action::make('speedtest')
2943
->label('Queue Speedtest')
44+
->color('primary')
3045
->action('queueSpeedtest')
3146
->hidden(fn (): bool => ! auth()->user()->is_admin && ! auth()->user()->is_user),
3247
];

app/Providers/Filament/AdminPanelProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ public function panel(Panel $panel): Panel
8080
->collapsible(false),
8181
])
8282
->navigationItems([
83-
NavigationItem::make('Home')
84-
->url('/')
85-
->icon('heroicon-o-home')
86-
->sort(0),
8783
NavigationItem::make('Documentation')
8884
->url('https://docs.speedtest-tracker.dev/', shouldOpenInNewTab: true)
8985
->icon('heroicon-o-book-open')

routes/web.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
->middleware('x-frame-allow')
1919
->name('home');
2020

21-
Route::get('/login', function () {
22-
return redirect('/admin/login');
23-
})->name('login');
21+
Route::redirect('/login', '/admin/login')
22+
->name('login');
2423

2524
require __DIR__.'/debug.php';
2625

0 commit comments

Comments
 (0)