F
Filament2mo ago
rabol

Filament::getPanel('dashboard')->getUrl() returns the wrong url

I have a laravel app, based on JetStream, I have two panels, Admin and Dashboard in my
resources/navigation-menu.blade.php
resources/navigation-menu.blade.php
I have this:
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ Filament::getPanel('dashboard')->getUrl() }}">
<x-application-mark class="block h-9 w-auto"/>
</a>
</div>
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ Filament::getPanel('dashboard')->getUrl() }}">
<x-application-mark class="block h-9 w-auto"/>
</a>
</div>
but.... the url is mysite.test/admin and not mysite.test/dashboard if I then create a simple view like this:
@php
use Filament\Facades\Filament;
@endphp

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Simple') }}
</h2>
</x-slot>

<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-xl sm:rounded-lg">
<a href="{{ Filament::getPanel('dashboard')->getUrl() }}">dashboard</a>
</div>
</div>
</div>
</x-app-layout>
@php
use Filament\Facades\Filament;
@endphp

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Simple') }}
</h2>
</x-slot>

<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-xl sm:rounded-lg">
<a href="{{ Filament::getPanel('dashboard')->getUrl() }}">dashboard</a>
</div>
</div>
</div>
</x-app-layout>
the url is ok in the view but not in the menu
1 Reply
rabol
rabol2mo ago
Funny thing: if I remove ->default from the AdminPanel, then I get this error in the navigation-menu.blade.php
Cannot assign null to property Filament\Navigation\NavigationManager::$panel of type Filament\Panel
Cannot assign null to property Filament\Navigation\NavigationManager::$panel of type Filament\Panel
if I add ->default() to the dashboard panel it seems to work - but I cannot have 2 default panels...
Want results from more Discord servers?
Add your server